PluginProbe
LoftLoader / trunk
LoftLoader vtrunk
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 trunk, at assets/js/preview.js

38 lines 1.4 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 var $loaderWrapper = $( '#loftloader-wrapper' );
9 // Helper functions
10 /***** Update style element by id inside <head>, if not exist, create new *****/
11 function loftloader_update_style(id, style){
12 var $style = $('head').find('#' + id);
13 $style = $style.length ? $style : $('<style>').attr('id', id).html('').appendTo($('head'));
14 $style.html(style);
15 }
16 // Change loader background opacity instantly
17 api('loftloader_bg_opacity', function( value ) {
18 value.bind( function( to ) {
19 loftloader_update_style('loftloader-lite-custom-bg-opacity', '#loftloader-wrapper .loader-section { opacity: ' + (to / 100) + '; }');
20 });
21 });
22 // Change loader background color
23 api('loftloader_bg_color', function(value){
24 value.bind(function(to){
25 loftloader_update_style('loftloader-lite-custom-bg-color', '#loftloader-wrapper .loader-section { background-color: ' + to + '; }');
26 });
27 });
28 $('body').hover(function(e){
29 $(this).addClass('loaded');
30 }, function(e){
31 $(this).removeClass('loaded');
32 });
33 }
34 else if($('#loftloader-wrapper').length){
35 $(window).load(function(){ $('body').addClass('loaded'); });
36 }
37 })(wp.customize, jQuery, parent.document, parent.wp.customize);
38