source: ether_statistics/web/resources/js/library/jquery-ui-1.9.0.custom/development-bundle/demos/accordion/hoverintent.html @ 608

Last change on this file since 608 was 608, checked in by vmipsl, 12 years ago

images

File size: 3.7 KB
Line 
1<!doctype html>
2<html lang="en">
3<head>
4        <meta charset="utf-8">
5        <title>jQuery UI Accordion - Open on hoverintent</title>
6        <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7        <script src="../../jquery-1.8.2.js"></script>
8        <script src="../../ui/jquery.ui.core.js"></script>
9        <script src="../../ui/jquery.ui.widget.js"></script>
10        <script src="../../ui/jquery.ui.accordion.js"></script>
11        <link rel="stylesheet" href="../demos.css">
12        <script>
13        $(function() {
14                $( "#accordion" ).accordion({
15                        event: "click hoverintent"
16                });
17        });
18
19        var cfg = ($.hoverintent = {
20                sensitivity: 7,
21                interval: 100
22        });
23
24        $.event.special.hoverintent = {
25                setup: function() {
26                        $( this ).bind( "mouseover", jQuery.event.special.hoverintent.handler );
27                },
28                teardown: function() {
29                        $( this ).unbind( "mouseover", jQuery.event.special.hoverintent.handler );
30                },
31                handler: function( event ) {
32                        var that = this,
33                                args = arguments,
34                                target = $( event.target ),
35                                cX, cY, pX, pY;
36
37                        function track( event ) {
38                                cX = event.pageX;
39                                cY = event.pageY;
40                        };
41                        pX = event.pageX;
42                        pY = event.pageY;
43                        function clear() {
44                                target
45                                        .unbind( "mousemove", track )
46                                        .unbind( "mouseout", arguments.callee );
47                                clearTimeout( timeout );
48                        }
49                        function handler() {
50                                if ( ( Math.abs( pX - cX ) + Math.abs( pY - cY ) ) < cfg.sensitivity ) {
51                                        clear();
52                                        event.type = "hoverintent";
53                                        // prevent accessing the original event since the new event
54                                        // is fired asynchronously and the old event is no longer
55                                        // usable (#6028)
56                                        event.originalEvent = {};
57                                        jQuery.event.handle.apply( that, args );
58                                } else {
59                                        pX = cX;
60                                        pY = cY;
61                                        timeout = setTimeout( handler, cfg.interval );
62                                }
63                        }
64                        var timeout = setTimeout( handler, cfg.interval );
65                        target.mousemove( track ).mouseout( clear );
66                        return true;
67                }
68        };
69        </script>
70</head>
71<body>
72
73<div id="accordion">
74        <h3>Section 1</h3>
75        <div>
76                <p>
77                Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
78                ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
79                amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
80                odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
81                </p>
82        </div>
83        <h3>Section 2</h3>
84        <div>
85                <p>
86                Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
87                purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
88                velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
89                suscipit faucibus urna.
90                </p>
91        </div>
92        <h3>Section 3</h3>
93        <div>
94                <p>
95                Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
96                Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
97                ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
98                lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
99                </p>
100                <ul>
101                        <li>List item one</li>
102                        <li>List item two</li>
103                        <li>List item three</li>
104                </ul>
105        </div>
106        <h3>Section 4</h3>
107        <div>
108                <p>
109                Cras dictum. Pellentesque habitant morbi tristique senectus et netus
110                et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
111                faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
112                mauris vel est.
113                </p>
114                <p>
115                Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
116                Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
117                inceptos himenaeos.
118                </p>
119        </div>
120</div>
121
122<div class="demo-description">
123<p>
124Click headers to expand/collapse content that is broken into logical sections, much like tabs.
125Optionally, toggle sections open/closed on mouseover.
126</p>
127<p>
128The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is
129usable without JavaScript.
130</p>
131</div>
132</body>
133</html>
Note: See TracBrowser for help on using the repository browser.