Skip to content

Commit

Permalink
Handle issue when ticker is moved quickly using buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
vaakash committed Jan 2, 2022
1 parent ea9d510 commit 82e9bfd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function(grunt) {

uglify: {
options: {
banner: '/*jQuery easy ticker v<%= pkg.version %> - (c) 2021 <%= pkg.author %>*/'
banner: '/*jQuery easy ticker v<%= pkg.version %> - (c) 2022 <%= pkg.author %>*/'
},
my_target: {
files: {
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jQuery easy ticker is a news ticker like plugin which scrolls a list infinitely.
* The speed of the transition can be changed.
* Controls can be added in order to Play/pause or move the list up and down.
* Cross browser support.
* Light weight (2.72 KB - minified).
* Light weight (2.76 KB - minified).

## Usage

Expand Down Expand Up @@ -100,4 +100,4 @@ Plugin's documentation is available in the plugin homepage. Please refer [this p

## License

Copyright (c) 2021 [Aakash Chakravarthy](https://www.aakashweb.com/), released under the MIT License.
Copyright (c) 2022 [Aakash Chakravarthy](https://www.aakashweb.com/), released under the MIT License.
4 changes: 2 additions & 2 deletions dist/jquery.easy-ticker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion easyticker.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"vertical",
"easing"
],
"version": "3.2.1",
"version": "3.3.0",
"author": {
"name": "Aakash Chakravarthy",
"url": "https://www.aakashweb.com/"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-easy-ticker",
"version": "3.2.1",
"version": "3.3.0",
"description": "jQuery easy ticker plugin allows to add news ticker like scroll to list elements",
"scripts": {
"build": "grunt"
Expand Down
11 changes: 9 additions & 2 deletions src/jquery.easy-ticker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jQuery - Easy Ticker plugin - v3.2.1
* jQuery - Easy Ticker plugin - v3.3.0
* https://www.aakashweb.com/
* Copyright 2021, Aakash Chakravarthy
* Released under the MIT License.
Expand Down Expand Up @@ -38,6 +38,7 @@
s.elem = $(el);
s.targ = $(el).children(':first-child');
s.timer = 0;
s.moving = false;

init();
start();
Expand Down Expand Up @@ -111,6 +112,8 @@
function move(dir){
var sel, eq, appType;

if(s.moving) return;

if(!s.elem.is(':visible')) return;

if(dir == 'up'){
Expand All @@ -130,6 +133,8 @@
s.opts.callbacks.before.call(s, s.targ, selChild);
}

s.moving = true;

s.targ.stop(true, true).animate({
'top': eq + height + 'px'
}, s.opts.speed, s.opts.easing, function(){
Expand All @@ -138,7 +143,9 @@
s.targ.css('top', 0);

adjustHeight(true);


s.moving = false;

if(typeof s.opts.callbacks.after === 'function'){
s.opts.callbacks.after.call(s, s.targ, selChild);
}
Expand Down
10 changes: 9 additions & 1 deletion test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@
myET.start();
});

$('.myTicker3').easyTicker();
var ticker3 = $('.myTicker3').easyTicker().data('easyTicker');
$('.up3').click(function(){
ticker3.up();
});

$('.down3').click(function(){
ticker3.down();
});

});
</script>
Expand Down Expand Up @@ -92,6 +99,7 @@ <h2>Ticker 2</h2>
</div>

<h2>Ticker 3</h2>
<button class="up3">Up</button> <button class="down3">Down</button>
<div class="myTicker3">
<ul>
<li>Triangles can be made easily using CSS also without any images. This trick requires only div tags and some CSS works. To get this trick, just use the code below.</li>
Expand Down

0 comments on commit 82e9bfd

Please sign in to comment.