FIX: Skrypt jquery.loggin.js nie działał w Safari 4.
[redakcja.git] / project / static / js / jquery.hpanel.js
index eb6d8bd..a3e80ec 100644 (file)
                        // $('.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) {
                        // $('.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');
                        });
 
                        $('.panel-overlay', event.data.root).css('display', 'none');
                var prev = null;
 
                all_panels.each(function(i) {
                var prev = null;
 
                all_panels.each(function(i) {
-                       var panel = $(all_panels[i]);
+                       var panel = $(this);
                        var handle = $('.panel-slider', panel);
                        var handle = $('.panel-slider', panel);
-
-                       var overlay     = $("<div class='panel-content-overlay panel-wrap'><p>Panel #"+i+"</p></div>");
+                       var overlay = $("<div class='panel-content-overlay panel-wrap'><p>Panel #"+i+"</p></div>");
                        overlay_root.append(overlay);
                        overlay.data('panel', panel);
                        overlay.data('next', null);
 
                        overlay_root.append(overlay);
                        overlay.data('panel', panel);
                        overlay.data('next', null);
 
-                       if( panel.hasClass('last-panel') )
+                       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;
 
                                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(handle.length != 0) {
+                               $.log('Has handle: ' + panel.attr('id') );
                                overlay.append(handle.clone());
                                /* attach the trigger */
                                handle.mousedown(function(event) {
                                overlay.append(handle.clone());
                                /* attach the trigger */
                                handle.mousedown(function(event) {
                                        $(this).trigger('hpanel:panel-resize-start', touch_data);
                                        return false;
                                });
                                        $(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;
                        }
                                
                        prev = overlay;