ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
index.php
Go to the documentation of this file.
1 <?PHP
2 
3 include "../index.php";
4 
5 $shell['title3'] = "mouseoveroutside";
6 
7 $shell['h2'] = 'Why mouse-over something, when you can mouse-over everything else?';
8 
9 // ========================================================================== //
10 // SCRIPT
11 // ========================================================================== //
12 
13 ob_start();
14 ?>
15 $(function(){
16 
17  // Elements on which to bind the event.
18  var elems = $('#test, #test div, #test .bind-me');
19 
20  // Clear any previous highlights and text.
21  $(document)
22  .bind( 'mouseover', function(event){
23  elems
24  .removeClass( 'event-outside' )
25  .children( '.event-target' )
26  .text( ' ' );
27  })
28  .trigger( 'mouseover' );
29 
30  // Bind the 'mouseoveroutside' event to each test element.
31  elems.bind( 'mouseoveroutside', function(event){
32  var elem = $(this),
33  target = $(event.target),
34 
35  // Update the text to reference the event.target element.
36  text = 'Mouse-over: ' + target[0].tagName.toLowerCase()
37  + ( target.attr('id') ? '#' + target.attr('id')
38  : target.attr('class') ? '.' + target.attr('class').replace( / /g, '.' )
39  : ' ' );
40 
41  // Highlight this element and set its text.
42  elem
43  .addClass( 'event-outside' )
44  .children( '.event-target' )
45  .text( text );
46  });
47 
48 });
49 <?
50 $shell['script'] = ob_get_contents();
51 ob_end_clean();
52 
53 // ========================================================================== //
54 // HTML HEAD ADDITIONAL
55 // ========================================================================== //
56 
57 ob_start();
58 ?>
59 <script type="text/javascript" src="../../jquery.ba-outside-events.js"></script>
60 <script type="text/javascript" language="javascript">
61 
62 <?= $shell['script']; ?>
63 
64 $(function(){
65 
66  // Syntax highlighter.
67  SyntaxHighlighter.highlight();
68 
69 });
70 
71 </script>
72 <style type="text/css" title="text/css">
73 
74 /*
75 bg: #FDEBDC
76 bg1: #FFD6AF
77 bg2: #FFAB59
78 orange: #FF7F00
79 brown: #913D00
80 lt. brown: #C4884F
81 */
82 
83 #page {
84  width: 700px;
85 }
86 
87 #test,
88 #test div {
89  padding: 1em;
90  margin-top: 1em;
91 }
92 
93 #test .bind-me {
94  padding: 0 0.5em;
95  margin-left: 0.5em;
96  white-space: nowrap;
97  line-height: 1.6em;
98 }
99 
100 #test,
101 #test div,
102 #test .bind-me {
103  color: #ccc;
104  border: 2px solid #ccc;
105 }
106 
107 .event-outside {
108  color: #0a0 !important;
109  border-color: #0a0 !important;
110  background-color: #cfc !important;
111 }
112 
113 #test .bind-me,
114 .event-target {
115  display: inline-block;
116  width: 180px;
117  overflow: hidden;
118  white-space: pre;
119  vertical-align: middle;
120 }
121 
122 </style>
123 <?
124 $shell['html_head'] = ob_get_contents();
125 ob_end_clean();
126 
127 // ========================================================================== //
128 // HTML BODY
129 // ========================================================================== //
130 
131 ob_start();
132 ?>
133 <?= $shell['donate'] ?>
134 
135 <p>
136  With <a href="http://benalman.com/projects/jquery-outside-events-plugin/">jQuery outside events</a> you can bind to an event that will be triggered only when a specific "originating" event occurs <em>outside</em> the element in question. For example, you can <a href="../clickoutside/">click outside</a>, <a href="../dblclickoutside/">double-click outside</a>, <a href="../mouseoveroutside/">mouse-over outside</a>, <a href="../focusoutside/">focus outside</a> (and <a href="http://benalman.com/code/projects/jquery-outside-events/docs/files/jquery-ba-outside-events-js.html#Defaultoutsideevents">over ten more</a> default "outside" events).
137 </p>
138 <p>
139  You get the idea, right?
140 </p>
141 
142 <h2>The mouseoveroutside event, bound to a few elements</h2>
143 
144 <p>Just mouse around, and see for yourself!</p>
145 
146 <div id="test">
147  test <span class="event-target"></span>
148 
149  <div id="a">
150  a <span class="event-target"></span>
151  <div id="b">
152  b <span class="event-target"></span>
153  </div>
154  </div>
155 
156  <div id="c">
157  c <span class="event-target"></span>
158  <span id="d" class="bind-me">d <span class="event-target"></span> </span>
159  <span id="e" class="bind-me">e <span class="event-target"></span> </span>
160  </div>
161 
162  <div id="f">
163  f <span class="event-target"></span>
164  <div id="g">
165  g <span class="event-target"></span>
166  <span id="h" class="bind-me">h <span class="event-target"></span> </span>
167  <span id="i" class="bind-me">i <span class="event-target"></span> </span>
168  </div>
169  </div>
170 </div>
171 
172 <h3>The code</h3>
173 
174 <div class="clear"></div>
175 
176 <pre class="brush:js">
177 <?= htmlspecialchars( $shell['script'] ); ?>
178 </pre>
179 
180 <?
181 $shell['html_body'] = ob_get_contents();
182 ob_end_clean();
183 
184 // ========================================================================== //
185 // DRAW SHELL
186 // ========================================================================== //
187 
188 draw_shell();
189 
190 ?>
PHP
Definition: index.php:3
$shell['title3']
Definition: index.php:5
draw_shell()
Definition: index.php:27