X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/626e9c46c2cf49a63b887c8b8f800bf55f9d7ae9..ab2c0be6275e50a83cd07fff92a08e01a663abae:/project/static/js/jquery.hpanel.js?ds=inline diff --git a/project/static/js/jquery.hpanel.js b/project/static/js/jquery.hpanel.js index eb6d8bdb..bec82e06 100644 --- a/project/static/js/jquery.hpanel.js +++ b/project/static/js/jquery.hpanel.js @@ -28,20 +28,21 @@ // $('.panel-content', event.data.root).css('display', 'block'); var overlays = $('.panel-content-overlay', event.data.root); $('.panel-content-overlay', event.data.root).each(function(i) { - $(this).data('panel').css({ - 'left': $(this).css('left'), - 'width': $(this).css('width') - }); + if( $(this).data('panel').hasClass('last-panel') ) + $(this).data('panel').css({ + 'left': $(this).css('left'), 'right': $(this).css('right')}); + else + $(this).data('panel').css({ + 'left': $(this).css('left'), 'width': $(this).css('width')}); }); - $('.panel-overlay', event.data.root).css('display', 'none'); + $(event.data.root).trigger('stopResize'); } }; $.fn.makeHorizPanel = function(options) { var root = $(this) - var all_panels = $('.panel-wrap', root) /* create an overlay */ var overlay_root = $("
"); @@ -49,23 +50,24 @@ var prev = null; - all_panels.each(function(i) { - var panel = $(all_panels[i]); + $('*.panel-wrap', root).each( function() + { + var panel = $(this); var handle = $('.panel-slider', panel); - - var overlay = $("

Panel #"+i+"

"); + var overlay = $("
 
"); overlay_root.append(overlay); overlay.data('panel', panel); overlay.data('next', null); - if( panel.hasClass('last-panel') ) - overlay.css({'left': panel.css('left'), 'right': panel.css('right')}); - else - overlay.css({'left': panel.css('left'), 'width': panel.css('width')}); - if (prev) prev.next = overlay; - if(handle) { + if( panel.hasClass('last-panel') ) + { + overlay.css({'left': panel.css('left'), 'right': panel.css('right')}); + } + else { + overlay.css({'left': panel.css('left'), 'width': panel.css('width')}); + $.log('Has handle: ' + panel.attr('id')); overlay.append(handle.clone()); /* attach the trigger */ handle.mousedown(function(event) { @@ -77,14 +79,16 @@ $(this).trigger('hpanel:panel-resize-start', touch_data); return false; }); - $('.panel-content', panel).css('right',handle.outerWidth() + 'px'); - $('.panel-content-overlay', panel).css('right',handle.outerWidth() + 'px'); - } - + $('.panel-content', panel).css('right', + (handle.outerWidth() || 10) + 'px'); + $('.panel-content-overlay', panel).css('right', + (handle.outerWidth() || 10) + 'px'); + }; + prev = overlay; }); - root.bind('hpanel:panel-resize-start', $.hpanel.resize_start); + root.bind('hpanel:panel-resize-start', $.hpanel.resize_start); }; })(jQuery);