Skip to content

Commit b974b83

Browse files
committed
Bugfixes; Bounce mode & disabling touch support when links are present
1 parent 13438e5 commit b974b83

6 files changed

+131
-20
lines changed

jquery.simplyscroll.css

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
* simplyScroll 2 - a scroll-tastic jQuery plugin
33
*
44
* http://logicbox.net/jquery/simplyscroll
5-
* http://plugins.jquery.com/project/simplyScroll
65
*
7-
* Copyright (c) 2009-2011 Will Kelly - http://logicbox.net
6+
* Copyright (c) 2009-2012 Will Kelly - http://logicbox.net
87
*
9-
* Dual licensed under the MIT (MIT-LICENSE.txt)
10-
* and GPL (GPL-LICENSE.txt) licenses.
8+
* Dual licensed under the MIT and GPL licenses.
119
*
1210
* Last revised: 31/01/2012
1311
*

jquery.simplyscroll.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Dual licensed under the MIT and GPL licenses.
99
*
10-
* Version: 2.0.4 Last revised: 24/02/2012
10+
* Version: 2.0.5 Last revised: 10/05/2012
1111
*
1212
*/
1313

@@ -156,7 +156,10 @@ $.simplyScroll.fn.extend({
156156
//due to inconsistent RTL implementation force back to LTR then fake
157157
if (this.isRTL) {
158158
this.$clip[0].dir = 'ltr';
159-
//this.$items.css('float','right');
159+
if (this.isHorizontal()) {
160+
//based on feedback seems a good idea to force float right
161+
this.$items.css('float','right');
162+
}
160163
}
161164
}
162165

@@ -243,6 +246,7 @@ $.simplyScroll.fn.extend({
243246
self.moveForward();
244247
}
245248
};
249+
this.funcMovePause = function() { self.movePause(); };
246250
this.funcMoveStop = function() { self.moveStop(); };
247251
this.funcMoveResume = function() { self.moveResume(); };
248252

@@ -255,16 +259,21 @@ $.simplyScroll.fn.extend({
255259
function togglePause() {
256260
if (self.paused===false) {
257261
self.paused=true;
258-
self.funcMoveStop();
262+
self.funcMovePause();
259263
} else {
260264
self.paused=false;
261265
self.funcMoveResume();
262266
}
263267
return self.paused;
264268
};
265269

270+
//disable pauseTouch when links are present
271+
if (this.supportsTouch && this.$items.find('a').length) {
272+
this.supportsTouch=false;
273+
}
274+
266275
if (this.isAuto && this.o.pauseOnHover && !this.supportsTouch) {
267-
this.$clip.bind(this.events.start,this.funcMoveStop).bind(this.events.end,this.funcMoveResume);
276+
this.$clip.bind(this.events.start,this.funcMovePause).bind(this.events.end,this.funcMoveResume);
268277
} else if (this.isAuto && this.o.pauseOnTouch && !this.o.pauseButton && this.supportsTouch) {
269278

270279
var touchStartPos, scrollStartPos;
@@ -292,7 +301,7 @@ $.simplyScroll.fn.extend({
292301
self.$clip[0]['scroll' + self.scrollPos] = pos;
293302

294303
//force pause
295-
self.funcMoveStop();
304+
self.funcMovePause();
296305
self.paused = true;
297306
});
298307
} else {
@@ -352,8 +361,11 @@ $.simplyScroll.fn.extend({
352361
}
353362
},self.intervalDelay);
354363
},
355-
moveStop: function(moveDir) {
364+
movePause: function() {
356365
clearInterval(this.interval);
366+
},
367+
moveStop: function(moveDir) {
368+
this.movePause();
357369
if (this.trigger!==null) {
358370
if (typeof moveDir !== 'undefined') {
359371
$(this.trigger).addClass('disabled');

jquery.simplyscroll.min.js

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test_bounce.html

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<title>jQuery simplyScroll - Logicbox</title>
6+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
7+
</script>
8+
<!--<script type="text/javascript" src="/js/common.js"></script>-->
9+
<script type="text/javascript" src="../jquery.simplyscroll.js"></script>
10+
<link rel="stylesheet" href="../jquery.simplyscroll.css" media="all" type="text/css">
11+
<script type="text/javascript">
12+
(function($) {
13+
$(function() {
14+
$("#scroller").simplyScroll({autoMode: 'bounce'});
15+
});
16+
})(jQuery);
17+
</script>
18+
</head>
19+
20+
<body>
21+
22+
<ul id="scroller">
23+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080608_9N3H5GYL_tb.jpg" width="290" height="200" alt="Firehouse"></li>
24+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080513_4D3SD1BQ_tb.jpg" width="290" height="200" alt="Chloe nightclub"></li>
25+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080513_VPJWVQRW_tb.jpg" width="290" height="200" alt="Firehouse bar"></li>
26+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080514_B1YJ08B6_tb.jpg" width="290" height="200" alt="Firehouse chloe club fishtank"></li>
27+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080514_JYW68XPT_tb.jpg" width="290" height="200" alt="Firehouse restaurant"></li>
28+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080608_38CG51J2_tb.jpg" width="290" height="200" alt="Firehouse"></li>
29+
</ul>
30+
31+
32+
</body>
33+
</html>

test/test_framerate60.html

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<title>jQuery simplyScroll - Logicbox</title>
6+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
7+
</script>
8+
<!--<script type="text/javascript" src="/js/common.js"></script>-->
9+
<script type="text/javascript" src="../jquery.simplyscroll.js"></script>
10+
<link rel="stylesheet" href="../jquery.simplyscroll.css" media="all" type="text/css">
11+
<script type="text/javascript">
12+
(function($) {
13+
$(function() {
14+
$("#scroller").simplyScroll({frameRate:60});
15+
});
16+
})(jQuery);
17+
</script>
18+
</head>
19+
20+
<body>
21+
22+
<ul id="scroller">
23+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080608_9N3H5GYL_tb.jpg" width="290" height="200" alt="Firehouse"></li>
24+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080513_4D3SD1BQ_tb.jpg" width="290" height="200" alt="Chloe nightclub"></li>
25+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080513_VPJWVQRW_tb.jpg" width="290" height="200" alt="Firehouse bar"></li>
26+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080514_B1YJ08B6_tb.jpg" width="290" height="200" alt="Firehouse chloe club fishtank"></li>
27+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080514_JYW68XPT_tb.jpg" width="290" height="200" alt="Firehouse restaurant"></li>
28+
<li><img src="http://logicbox.net/jquery/simplyscroll/assets/20080608_38CG51J2_tb.jpg" width="290" height="200" alt="Firehouse"></li>
29+
</ul>
30+
31+
32+
</body>
33+
</html>

test/test_pausetouch_links.html

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<title>jQuery simplyScroll - Logicbox</title>
6+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js">
7+
</script>
8+
<script type="text/javascript" src="../jquery.simplyscroll.js"></script>
9+
<link rel="stylesheet" href="../jquery.simplyscroll.css" media="all" type="text/css">
10+
<script type="text/javascript">
11+
(function($) {
12+
$(function() {
13+
$("#scroller").simplyScroll({
14+
pauseOnTouch: true,
15+
pauseOnHover: false
16+
});
17+
});
18+
})(jQuery);
19+
</script>
20+
</head>
21+
22+
<body>
23+
24+
<ul id="scroller">
25+
<li><a href="http://logicbox.net/jquery/simplyscroll/assets/20080608_9N3H5GYL_tb.jpg"><img src="http://logicbox.net/jquery/simplyscroll/assets/20080608_9N3H5GYL_tb.jpg" width="290" height="200" alt="Firehouse"></a></li>
26+
<li><a href="http://logicbox.net/jquery/simplyscroll/assets/20080513_4D3SD1BQ_tb.jpg"><img src="http://logicbox.net/jquery/simplyscroll/assets/20080513_4D3SD1BQ_tb.jpg" width="290" height="200" alt="Chloe nightclub"></li>
27+
<li><a href="http://logicbox.net/jquery/simplyscroll/assets/20080513_VPJWVQRW_tb.jpg"><img src="http://logicbox.net/jquery/simplyscroll/assets/20080513_VPJWVQRW_tb.jpg" width="290" height="200" alt="Firehouse bar"></li>
28+
<li><a href="http://logicbox.net/jquery/simplyscroll/assets/20080514_B1YJ08B6_tb.jpg"><img src="http://logicbox.net/jquery/simplyscroll/assets/20080514_B1YJ08B6_tb.jpg" width="290" height="200" alt="Firehouse chloe club fishtank"></li>
29+
<li><a href="http://logicbox.net/jquery/simplyscroll/assets/20080514_JYW68XPT_tb.jpg"><img src="http://logicbox.net/jquery/simplyscroll/assets/20080514_JYW68XPT_tb.jpg" width="290" height="200" alt="Firehouse restaurant"></li>
30+
<li><a href="http://logicbox.net/jquery/simplyscroll/assets/20080608_38CG51J2_tb.jpg"><img src="http://logicbox.net/jquery/simplyscroll/assets/20080608_38CG51J2_tb.jpg" width="290" height="200" alt="Firehouse"></li>
31+
</ul>
32+
33+
34+
</body>
35+
</html>

0 commit comments

Comments
 (0)