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);
11 $('iframe').bind('mousemove', mydata, $.hpanel.resize_changed).
12 bind('mouseup', mydata, $.hpanel.resize_stop);
15 resize_changed: function(event) {
16 var old_width = parseInt(event.data.panel.css('width'));
17 var delta = event.pageX + event.data.hotspot_x - old_width;
18 event.data.panel.css({'width': old_width + delta});
20 if(event.data.panel.next_panel) {
21 var left = parseInt(event.data.panel.next_panel.css('left'));
22 console.log('left: ' + left + ' new_left: ' + (left+delta) );
23 event.data.panel.next_panel.css('left', left+delta);
28 resize_stop: function(event) {
29 $(document).unbind('mousemove', $.hpanel.resize_changed).unbind('mouseup', $.hpanel.resize_stop);
30 $('iframe').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);