ILIAS  release_7 Revision v7.30-3-g800a261c036
index.php
Go to the documentation of this file.
2
3include "../index.php";
4
5$shell['title3'] = "clickoutside";
6
7$shell['h2'] = 'Why click something, when you can click everything else?';
8
9// ========================================================================== //
10// SCRIPT
11// ========================================================================== //
12
13ob_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( 'click', function(event){
23 elems
24 .removeClass( 'event-outside' )
25 .children( '.event-target' )
26 .text( ' ' );
27 })
28 .trigger( 'click' );
29
30 // Bind the 'clickoutside' event to each test element.
31 elems.bind( 'clickoutside', function(event){
32 var elem = $(this),
33 target = $(event.target),
34
35 // Update the text to reference the event.target element.
36 text = 'Clicked: ' + 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();
51ob_end_clean();
52
53// ========================================================================== //
54// HTML HEAD ADDITIONAL
55// ========================================================================== //
56
57ob_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/*
75bg: #FDEBDC
76bg1: #FFD6AF
77bg2: #FFAB59
78orange: #FF7F00
79brown: #913D00
80lt. 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();
125ob_end_clean();
126
127// ========================================================================== //
128// HTML BODY
129// ========================================================================== //
130
131ob_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 clickoutside event, bound to a few elements</h2>
143
144<p>Just click 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();
182ob_end_clean();
183
184// ========================================================================== //
185// DRAW SHELL
186// ========================================================================== //
187
188draw_shell();
189
190?>
language()
Definition: language.php:2
more()
Definition: more.php:2
$shell['title3']
Definition: index.php:5
PHP
Definition: index.php:3
draw_shell()
Definition: index.php:27