risq / jquery-advanced-news-ticker

(deprecated) - A powerful, flexible and animated vertical news ticker plugin for JQuery.
http://risq.github.io/jquery-advanced-news-ticker
GNU General Public License v2.0
297 stars 104 forks source link

Do not scroll when there is only one item. #21

Open rcdmk opened 9 years ago

rcdmk commented 9 years ago

When there is only one item in the scroll the ticker stills animate it. It would be usefull to add a configuration flag to turning this off.

I can confirm this occurs on a page with multiple tickers.

philipjnorton commented 9 years ago

if($('.newsticker li').length >1) //condition before calling newsTicker plugin $('.newsticker').newsTicker();

rcdmk commented 9 years ago

It was the workaround I've used.

Would be nice if it could be disabled by code to allow dynamic contente to be added and removed and the plugin wold be aware.

Maybe I can fork it to make it happen. Thank you!

lenamtl commented 8 years ago

+1

cportermalta commented 8 years ago

Although this won't work well if you are adding and removing stuff dynamically from the ul/ol.

In this case, I added a check on the moveDown and moveUp functions - whereby I init the animations only if more than one item is on the list - otherwise remove existing animations bound to the single element in the list.

This is an example: moveDown: function () { if (this.$el.children('li').length > 1) { .... } else { this.$el.children('li').stop(true, true); } },

Same thing applies for moveUp

Hope this helps.

Chris