-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
75 lines (75 loc) · 1.89 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>jquery.path.js</title>
<style type="text/css">
.width{
margin:0 auto;
width: 802px;
}
.highlight{
outline: 1px solid red;
}
.option{
outline: 1px solid black;
}
div > div{
margin-left: 10px;
}
</style>
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="jquery.path.js"></script>
<script type="text/javascript">
(function($){
$(function(){
var $path = $('#Path');
$path.click(function(event){
event.preventDefault();
$('*').removeClass('highlight');
$($path.text()).addClass('highlight');
});
$('*').mouseenter(function (event) {
$('*').removeClass('option');
$(event.target).addClass('option');
if (event.shiftKey) {
$path.text($(event.target).path());
}
});
});
})(jQuery);
</script>
</head>
<body class="width">
<h1>jquery.path</h1>
<p>Returns a selector which will find the element on the dom when passed into jQuery</p>
<h2>Hold <span style="color:red">shift</span> while hovering over an element to generate path</h2>
<p><a href="#" id="Path">*</a><br/><em><span style="color:red">Click</span> to test generated selector</em></p>
<p>This is some content</p>
<div id="Testing">
<ul>
<li id="First">Content</li>
<li>Content</li>
<li>Content</li>
<li>Content</li>
<li>Content</li>
<li>Content</li>
<li>Content</li>
</ul>
</div>
<div>
<p>More and more nesting</p>
<div>
<p>More and more nesting</p>
<div>
<p>More and more nesting</p>
<div>
<p>More and more nesting</p>
<div>
<p>More and more nesting</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>