X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/b157bbf02932396c65c0aca9638c96200c4665df..3a211aa9d249e67425735f492407edbc2fd58a2f:/project/static/js/jquery.hpanel.js?ds=sidebyside diff --git a/project/static/js/jquery.hpanel.js b/project/static/js/jquery.hpanel.js index 2f917a88..bec82e06 100644 --- a/project/static/js/jquery.hpanel.js +++ b/project/static/js/jquery.hpanel.js @@ -35,15 +35,14 @@ $(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 = $("
"); @@ -51,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 (prev) prev.next = overlay; + if( panel.hasClass('last-panel') ) + { overlay.css({'left': panel.css('left'), 'right': panel.css('right')}); - else + } + else { overlay.css({'left': panel.css('left'), 'width': panel.css('width')}); - - if (prev) prev.next = overlay; - - if(handle) { + $.log('Has handle: ' + panel.attr('id')); overlay.append(handle.clone()); /* attach the trigger */ handle.mousedown(function(event) { @@ -83,12 +83,12 @@ (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);