File tree Expand file tree Collapse file tree 2 files changed +58
-14
lines changed
Expand file tree Collapse file tree 2 files changed +58
-14
lines changed Original file line number Diff line number Diff line change 3737 if ( api ) { ret = api ; }
3838
3939 // interval stuff
40- var timer , hoverTimer , stopped = true ;
40+ var timer , stopped = true ;
4141
4242 api . play = function ( ) {
4343
44+
4445 // do not start additional timer if already exists
4546 if ( timer ) { return ; }
4647
5152 api . next ( ) ;
5253 } , opts . interval ) ;
5354
54- api . next ( ) ;
5555 } ;
5656
5757 api . pause = function ( ) {
58- timer = clearInterval ( timer ) ;
58+ timer = clearInterval ( timer ) ;
5959 } ;
6060
6161 // when stopped - mouseover won't restart
6666
6767 /* when mouse enters, autoscroll stops */
6868 if ( opts . autopause ) {
69- api . getRoot ( ) . add ( api . getNaviButtons ( ) ) . hover ( function ( ) {
70- api . pause ( ) ;
71- clearInterval ( hoverTimer ) ;
72-
73- } , function ( ) {
74- if ( ! stopped ) {
75- hoverTimer = setTimeout ( api . play , opts . interval ) ;
76- }
77- } ) ;
78- }
69+ api . getRoot ( ) . add ( api . getNaviButtons ( ) ) . hover ( api . pause , api . play ) ;
70+ }
7971
8072 if ( opts . autoplay ) {
81- setTimeout ( api . play , opts . interval ) ;
73+ api . play ( ) ;
8274 }
8375
8476 } ) ;
Original file line number Diff line number Diff line change 1+
2+ < script src ="../js/jquery-1.3.2.js "> </ script >
3+ < script src ="../../src/scrollable/scrollable.js "> </ script >
4+ < script src ="../../src/scrollable/scrollable.autoscroll.js "> </ script >
5+
6+ < link rel ="stylesheet " type ="text/css " href ="style.css "/>
7+
8+ < script >
9+ $ ( function ( ) {
10+ $ ( ".scrollable" ) . scrollable ( {
11+ circular : true ,
12+
13+ onSeek : function ( ) {
14+ // console.info(this.getIndex());
15+ }
16+
17+ } ) . autoscroll ( { autoplay : true , interval : 1000 } ) ;
18+
19+ window . api = $ ( ".scrollable" ) . data ( "scrollable" ) ;
20+ } ) ;
21+ </ script >
22+
23+
24+ < div >
25+
26+ < a class ="prev "> prev</ a >
27+
28+ < div class ="navi "> </ div >
29+
30+ < div class ="scrollable " style ="width:130px ">
31+
32+ < div class ="items ">
33+ < div > 0</ div >
34+ < div > 1</ div >
35+ < div > 2</ div >
36+ < div > 3</ div >
37+ < div > 4</ div >
38+ < div > 5</ div >
39+ < div > 6</ div >
40+ </ div >
41+
42+ </ div >
43+
44+ < a class ="next "> next</ a >
45+
46+ </ div >
47+
48+ < p >
49+ < button onclick ='api.pause(); '> pause</ button >
50+ < button onclick ='api.play(); '> play</ button >
51+ </ p >
52+
You can’t perform that action at this time.
0 commit comments