7 resize_start: function(event, mydata) {
8 console.log('Panel ' + mydata.panel.attr('id') + ' started resizing');
9 $(document).bind('mousemove', mydata, $.hpanel.resize_changed).
10 bind('mouseup', mydata, $.hpanel.resize_stop);
13 resize_changed: function(event) {
14 var old_width = parseInt(event.data.panel.css('width'));
15 var delta = event.pageX + event.data.hotspot_x - old_width;
17 console.log('o: ' + (old_width) + ' pX: ' + event.pageX + ' hX: ' + event.data.hotspot_x);
18 console.log('next_panel: ' + $(event.data.panel.next_panel).attr('id'));
19 event.data.panel.css({'width': old_width + delta});
21 if(event.data.panel.next_panel) {
22 var left = parseInt(event.data.panel.next_panel.css('left'));
23 console.log('left: ' + left + ' new_left: ' + (left+delta) );
24 event.data.panel.next_panel.css('left', left+delta);
29 resize_stop: function(event) {
30 $(document).unbind('mousemove', $.hpanel.resize_changed).unbind('mouseup', $.hpanel.resize_stop);
31 $('body').css('cursor', 'auto');
35 $.fn.make_hpanel = function(options)
37 console.log('Making an hpanel out of "#' + $(this).attr('id') + '"');
39 var all_panels = $('.panel-wrap', root)
40 console.log('Panels: ' + all_panels);
44 all_panels.each(function(i) {
45 var panel = $(all_panels[i]);
46 var handle = $('.panel-slider', panel)
48 panel.next_panel = null;
49 if (prev) prev.next_panel = panel;
51 /* attach the trigger */
52 handle.mousedown(function(event) {
56 hotspot_x: event.pageX - handle.position().left
58 $(this).trigger('hpanel:panel-resize-start', touch_data);
64 root.bind('hpanel:panel-resize-start', $.hpanel.resize_start);