Skip to content

Commit 19d8e77

Browse files
committed
moved taphold example from iframe to within description
1 parent cc806dc commit 19d8e77

File tree

2 files changed

+60
-100
lines changed

2 files changed

+60
-100
lines changed

entries/taphold.xml

Lines changed: 60 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,72 @@
77

88
<p><code>$.event.special.tap.tapholdThreshold</code> (default: 750) - This value dictates how long the user must hold their tap before the taphold event is fired on the target element.</p>
99

10-
<xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
11-
<pre>
12-
<code><![CDATA[
13-
<style type="text/css">
14-
div.box {
15-
background-color: #598611;
16-
height: 3em;
17-
width: 3em;
18-
}
19-
div.box.taphold {
20-
background-color: #BB6F04;
21-
}
22-
</style>
23-
24-
...
25-
26-
<h3>Long-press (taphold) the green square to change its color:</h3>
27-
<div class="box"></div>
28-
29-
...
30-
31-
$(function() {
32-
// Bind the tapholdHandler callback function to the taphold event on div.box
33-
$( "div.box" ).on( 'taphold', tapholdHandler );
34-
35-
// Callback function references the event target and adds the 'tap' class to it
36-
function tapholdHandler( event ) {
37-
$(event.target).addClass( "taphold" );
38-
}
39-
});
40-
]]></code>
41-
</pre>
42-
<p>Long press the square for 750 milliseconds to see the above code applied.
43-
<iframe id="tapholdIframe" src="/resources/taphold/example1.html" style="width:100%;height:90px;border:0px"></iframe></p>
10+
<xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
4411
</longdesc>
4512
<added>1.0</added>
4613
<signature>
4714
<argument name="callback" type="Function" optional="true">
4815
<desc>A function to invoke after the the taphold event fires.</desc>
4916
</argument>
5017
</signature>
18+
<example>
19+
<height>120</height>
20+
<desc>A simple example of the capturing and acting upon a taphold event</desc>
21+
<code><![CDATA[
22+
$(function(){
23+
$( "div.box" ).bind( "taphold", tapholdHandler );
24+
25+
function tapholdHandler( event ){
26+
$(event.target).addClass( "taphold" );
27+
}
28+
});
29+
]]></code>
30+
<css><![CDATA[
31+
html, body { padding: 0; margin: 0; }
32+
html, .ui-mobile, .ui-mobile body {
33+
height: 85px;
34+
}
35+
.ui-mobile, .ui-mobile .ui-page {
36+
min-height: 85px;
37+
}
38+
#nav {
39+
font-size: 200%;
40+
width:17.1875em;
41+
margin:17px auto 0 auto;
42+
}
43+
#nav a {
44+
color: #777;
45+
border: 2px solid #777;
46+
background-color: #ccc;
47+
padding: 0.2em 0.6em;
48+
text-decoration: none;
49+
float: left;
50+
margin-right: 0.3em;
51+
}
52+
#nav a:hover {
53+
color: #999;
54+
border-color: #999;
55+
background: #eee;
56+
}
57+
#nav a.selected,
58+
#nav a.selected:hover {
59+
color: #0a0;
60+
border-color: #0a0;
61+
background: #afa;
62+
}
63+
div.box {
64+
width: 3em;
65+
height: 3em;
66+
background-color: #108040;
67+
}
68+
div.box.taphold {
69+
background-color: #7ACEF4;
70+
}
71+
]]></css>
72+
<html><![CDATA[
73+
<h3>Long press the square for 750 milliseconds to see the above code applied:</h3>
74+
<div class="box"></div>
75+
]]></html>
76+
</example>
5177
<category slug="events"/>
5278
</entry>

resources/taphold/example1.html

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)