X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/18691ef568f3b013ed5d71fa0d998cfc6842071f..653c75b6951e028fe4c68e27cc9852e45fa418a6:/project/static/js/jquery.hpanel.js diff --git a/project/static/js/jquery.hpanel.js b/project/static/js/jquery.hpanel.js index a3e80ece..1ad0d17f 100644 --- a/project/static/js/jquery.hpanel.js +++ b/project/static/js/jquery.hpanel.js @@ -11,7 +11,7 @@ $('.panel-overlay', mydata.root).css('display', 'block'); return false; }, - resize_changed: function(event) { + resize_changed: function(event) { var old_width = parseInt(event.data.overlay.css('width')); var delta = event.pageX + event.data.hotspot_x - old_width; event.data.overlay.css({'width': old_width + delta}); @@ -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) { + $('*.panel-wrap', root).each( function() + { var panel = $(this); var handle = $('.panel-slider', panel); - var overlay = $(" "); + 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.length != 0) { - $.log('Has handle: ' + panel.attr('id') ); + $.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);