Skip to content

Commit 16695b4

Browse files
committed
Merge pull request #44 from robertbosse/master
API Doc: Updates for hashtag and vmouseover
2 parents 8345f69 + 323aa73 commit 16695b4

File tree

5 files changed

+77
-24
lines changed

5 files changed

+77
-24
lines changed

entries/hashtag.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
});
3030
]]></code>
3131
</pre>
32-
<p>Click, and watch as the magic happens!
32+
<p>iFrame source: <span id="hashtagIframeLink">example1.html</span>
3333
<iframe id="hashtagIframe" src="/resources/hashtag/example1.html" style="width:100%;height:90px;border:0px"></iframe>
3434
</p>
3535
</longdesc>

entries/vmousecancel.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0"?>
2+
<entry name="hashtag" type="event" return="jQuery">
3+
<title>.vmousecancel()</title>
4+
<desc>Virtualized mousecancel event handler.</desc>
5+
<longdesc>
6+
<p>The jQuery Mobile <code>.vmousecancel()</code> event handler is called whenever the system cancels a virtualized mouse event. This is fired when the user decides to scroll the contents of the screen.</p>
7+
<xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
8+
</longdesc>
9+
<added>1.0</added>
10+
<signature>
11+
<argument name="callback" type="Function" optional="true">
12+
<desc>A function to invoke after the vmouseover event is fired.</desc>
13+
</argument>
14+
</signature>
15+
<example>
16+
<desc>A simple jQuery Mobile hashchange example.</desc>
17+
<code><![CDATA[
18+
$(function(){
19+
// Bind an event to window.onhashchange that, when the hash changes, gets the
20+
// hash and adds the class "selected" to any matching nav link.
21+
$(window).hashchange( function(){
22+
var hash = location.hash;
23+
24+
// Set the page title based on the hash.
25+
document.title = 'The hash is ' + ( hash.replace( /^#/, '' ) || 'blank' ) + '.';
26+
27+
// Iterate over all nav links, setting the "selected" class as-appropriate.
28+
$('#nav a').each(function(){
29+
var that = $(this);
30+
that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ]( 'selected' );
31+
});
32+
})
33+
// Since the event is only triggered when the hash changes, we need to trigger
34+
// the event now, to handle the hash the page may have loaded with.
35+
$(window).hashchange();
36+
});
37+
]]></code>
38+
</example>
39+
<pre>
40+
<code>
41+
<p>Click, and watch as the magic happens!
42+
<iframe src="/resources/hashtag/example1.html" style="width:100%;height:90px;border:0px"></iframe>
43+
</p>
44+
</code>
45+
</pre>
46+
<category slug="events"/>
47+
</entry>

entries/vmouseover.xml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0"?>
2-
<entry name="hashtag" type="event" return="jQuery">
2+
<entry name="vmouseover" type="event" return="jQuery">
33
<title>.vmouseover()</title>
44
<desc>Virtualized mouseover event handler.</desc>
55
<longdesc>
6-
<p>The jQuery Mobile <code>.vmouseover()</code> event handler simulates the "onmouseover" event handler on mobile devices.</p>
6+
<p>The jQuery Mobile <code>.vmouseover()</code> event handler simulates the "onmouseover" event handler on mobile devices. This is fired on the initial touch of the screen on the device.</p>
77
<xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
88
</longdesc>
99
<added>1.0</added>
@@ -13,33 +13,17 @@
1313
</argument>
1414
</signature>
1515
<example>
16-
<desc>A simple jQuery Mobile hashchange example.</desc>
16+
<desc>A simple jQuery Mobile vmouseover example.</desc>
1717
<code><![CDATA[
18-
$(function(){
19-
// Bind an event to window.onhashchange that, when the hash changes, gets the
20-
// hash and adds the class "selected" to any matching nav link.
21-
$(window).hashchange( function(){
22-
var hash = location.hash;
23-
24-
// Set the page title based on the hash.
25-
document.title = 'The hash is ' + ( hash.replace( /^#/, '' ) || 'blank' ) + '.';
26-
27-
// Iterate over all nav links, setting the "selected" class as-appropriate.
28-
$('#nav a').each(function(){
29-
var that = $(this);
30-
that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ]( 'selected' );
31-
});
32-
})
33-
// Since the event is only triggered when the hash changes, we need to trigger
34-
// the event now, to handle the hash the page may have loaded with.
35-
$(window).hashchange();
36-
});
18+
$('p').vmouseover(function(){
19+
$(this).append('<span style="color:#00F;">Mouse Over.</span>');
20+
});
3721
]]></code>
3822
</example>
3923
<pre>
4024
<code>
4125
<p>Click, and watch as the magic happens!
42-
<iframe src="/resources/hashtag/example1.html" style="width:100%;height:90px;border:0px"></iframe>
26+
<iframe src="/resources/vmouseover/example1.html" style="width:100%;height:90px;border:0px"></iframe>
4327
</p>
4428
</code>
4529
</pre>

resources/hashtag/example1.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
// To change src attribute of parent iframe element
7373
$('.hashExLink').on('click', function() {
7474
window.parent.document.getElementById( "hashtagIframe" ).src = "/resources/hashtag/example1.html" + $(this).attr( "href" );
75+
window.parent.document.getElementById( "hashtagIframeLink" ).innerHTML = "example1.html" + $(this).attr( "href" );
7576
});
7677
});
7778
</script>

resources/vmouseover/example1.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>hashtag demo</title>
7+
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css">
8+
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
9+
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
10+
</head>
11+
<body>
12+
<p>Touch here to see what happens.</p>
13+
<script>
14+
$(function(){
15+
$('p').vmouseover(function(){
16+
$(this).append('<span style="color:#00F;">vmouseover fired.</span>');
17+
});
18+
});
19+
</script>
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)