View difference between Paste ID: r2iywr9j and 8xZB9ZsD
SHOW: | | - or go back to the newest paste.
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<title>Notepad</title>
5
6
<link rel="stylesheet" href="closure-library/closure/goog/css/roundedtab.css">
7
<link rel="stylesheet" href="tabpane.css">
8
9
<script src="closure-library/closure/goog/base.js"></script>
10
<script>
11
  goog.require('goog.dom');
12
  goog.require('goog.fx.DragDrop');
13
  goog.require('goog.fx.DragListDirection');
14
  goog.require('goog.fx.DragListGroup');
15
  goog.require('goog.fx.DragScrollSupport');
16
  goog.require('goog.ui.TabPane'); 
17
</script>
18
<!-- script src="main.js"></script> -->
19
</head>
20
<body>
21
22
<div id="tabpane1" height="100%"></div>
23
24
<div id="page1">
25
  <div id="vert1_div" class="vert1_class">
26
    <div class="blue_box">1</div>
27
    <div class="blue_box">2</div>
28
    <div class="blue_box">3</div>
29
    <div class="blue_box">4</div>
30
  </div>
31
</div>
32
33
<div id="page2">
34
  <div id="vert2_div" class="vert2_class">
35
    <div class="purple_box">1</div>
36
    <div class="purple_box">2</div>
37
    <div class="purple_box">3</div>
38
    <div class="purple_box">4</div>
39
  </div>
40
</div>
41
42
43
44
<script>
45
  var scrollSupport = null;
46
  var tabPane = new goog.ui.TabPane(document.getElementById('tabpane1'));
47
  var tabPage1 = new goog.ui.TabPane.TabPage(document.getElementById('page1'), 'Page 1');
48
  var tabPage2 = new goog.ui.TabPane.TabPage(document.getElementById('page2'), 'Page 2');
49
  tabPane.addPage(tabPage1);
50
  tabPane.addPage(tabPage2);
51
  
52
  var dlg = new goog.fx.DragListGroup();
53
  dlg.setDragItemHoverClass('cursor_move');
54
  dlg.setDraggerElClass('cursor_move opacity_40');
55
56
  dlg.addDragList(goog.dom.getElement('vert1_div'),
57
      goog.fx.DragListDirection.DOWN);
58
  dlg.addDragList(goog.dom.getElement('vert2_div'),
59
      goog.fx.DragListDirection.DOWN, true, 'drag_hover_class');
60
  
61
  dlg.init();
62
  
63
  var dropPage1 = new goog.fx.DragDrop(tabPage1.getTitleElement());
64
  var dropPage2 = new goog.fx.DragDrop(tabPage2.getTitleElement());
65
  
66
   // Set up event handlers
67
  goog.events.listen(dlg, 'dragstart', dragStart);
68
  goog.events.listen(dlg, 'dragend', dragEnd);
69
70
  //this is not working as the DragDrop Elements are not valid targets
71
  goog.events.listen(dropPage1, 'dragover', dragEnter);
72
  goog.events.listen(dropPage2, 'dragover', dragEnter);
73
74
  function dragStart(event) {
75
    console.log("Attaching ScrollThingy");
76
    scrollSupport = new goog.fx.DragScrollSupport(
77
       goog.dom.getElementByClass('goog-tabpane-cont'));
78
  }
79
80
  function dragEnd(event) {
81
    console.log("Detaching ScrollThingy");
82
    goog.dispose(scrollSupport);
83
  }
84
  
85
  function dragEnter(event){ 
86
    console.log("UIUIUIUIUIU");
87
  }
88
89
  
90
</script>
91
92
</body>
93
</html>