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'] = "focusoutside";
6
7$shell['h2'] = 'Why focus something, when you can.. Um, nevermind.';
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( 'focusin', function(event){
23 elems
24 .removeClass( 'event-outside' )
25 .children( '.event-target' )
26 .text( ' ' );
27 })
28 .trigger( 'focusin' );
29
30 // Bind the 'focusoutside' event to each test element.
31 elems.bind( 'focusoutside', function(event){
32 var elem = $(this),
33 target = $(event.target),
34
35 // Update the text to reference the event.target element.
36 text = 'Focused: ' + 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.5em;
95 margin-left: 0.5em;
96 white-space: nowrap;
97 line-height: 1.5em;
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
113input.outside,
114#test input {
115 font-size: 10px;
116 border: 1px solid #000;
117 padding: 0.1em 0.3em;
118 width: 50px;
119}
120
121#test .bind-me,
122.event-target {
123 display: inline-block;
124 width: 130px;
125 overflow: hidden;
126 white-space: pre;
127 vertical-align: middle;
128}
129
130#test .bind-me {
131 width: 180px;
132}
133
134</style>
135<?
136$shell['html_head'] = ob_get_contents();
137ob_end_clean();
138
139// ========================================================================== //
140// HTML BODY
141// ========================================================================== //
142
143ob_start();
144?>
145<?= $shell['donate'] ?>
146
147<p>
148 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).
149</p>
150<p>
151 You get the idea, right?
152</p>
153
154<h2>The focusoutside event, bound to a few elements</h2>
155
156<p>Just focus some inputs, and see for yourself!</p>
157
158<input type="text" class="outside" value="outside" id="outside">
159
160<div id="test">
161 <input type="text" value="top" id="top">
162 <span class="event-target"></span>
163
164 <div>
165 <input type="text" value="a" id="a">
166 <span class="event-target"></span>
167 <div id="b">
168 <input type="text" value="b" id="b">
169 <span class="event-target"></span>
170 </div>
171 </div>
172
173 <div>
174 <input type="text" value="c" id="c">
175 <span class="event-target"></span>
176 <span class="bind-me"><input type="text" value="d" id="d"> <span class="event-target"></span> </span>
177 <span class="bind-me"><input type="text" value="e" id="e"> <span class="event-target"></span> </span>
178 </div>
179
180 <div>
181 <input type="text" value="f" id="f">
182 <span class="event-target"></span>
183 <div>
184 <input type="text" value="g" id="g">
185 <span class="event-target"></span>
186 <span class="bind-me"><input type="text" value="h" id="h"> <span class="event-target"></span> </span>
187 <span class="bind-me"><input type="text" value="i" id="i"> <span class="event-target"></span> </span>
188 </div>
189 </div>
190</div>
191
192<h3>The code</h3>
193
194<div class="clear"></div>
195
196<pre class="brush:js">
197<?= htmlspecialchars( $shell['script'] ); ?>
198</pre>
199
200<?
201$shell['html_body'] = ob_get_contents();
202ob_end_clean();
203
204// ========================================================================== //
205// DRAW SHELL
206// ========================================================================== //
207
208draw_shell();
209
210?>
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