PluginProbe
LoftLoader / 2.1.2
LoftLoader v2.1.2
trunk 1.0.0 1.0.1 1.0.2 2.0.0 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.3.3 All 34 releases
loftloader / assets / js / preview.js

preview.js in LoftLoader 2.1.2, at assets/js/preview.js

36 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Copyright (c) Loft.Ocean
3 * http://www.loftocean.com
4 */
5
6 (function(api, $, preview, parentAPI){
7 if(typeof parentAPI.settings.settings.loftloader_main_switch !== 'undefined'){
8 // Helper functions
9 /***** Update style element by id inside <head>, if not exist, create new *****/
10 function loftloader_update_style(id, style){
11 var $style = $('head').find('#' + id);
12 $style = $style.length ? $style : $('<style>').attr('id', id).html('').appendTo($('head'));
13 $style.html(style);
14 }
15 // Change loader background opacity instantly
16 api('loftloader_bg_opacity', function( value ) {
17 value.bind( function( to ) {
18 loftloader_update_style('loftloader-lite-custom-bg-opacity', '#loftloader-wrapper .loader-section { opacity: ' + (to / 100) + '; }');
19 });
20 });
21 // Change loader background color
22 api('loftloader_bg_color', function(value){
23 value.bind(function(to){
24 loftloader_update_style('loftloader-lite-custom-bg-color', '#loftloader-wrapper .loader-section { background-color: ' + to + '; }');
25 });
26 });
27 $('body').hover(function(e){
28 $(this).addClass('loaded');
29 }, function(e){
30 $(this).removeClass('loaded');
31 });
32 }
33 else if($('#loftloader-wrapper').length){
34 $(window).load(function(){ $('body').addClass('loaded'); });
35 }
36 })(wp.customize, jQuery, parent.document, parent.wp.customize);