mazedigital / Web-Ticker

A jQuery web ticker
https://maze.digital/webticker/
Other
172 stars 102 forks source link

settings is undefined #29

Open galastur opened 9 years ago

galastur commented 9 years ago

Hi,

I am trying to use the webticker, but got the following error when trying to stop it.

0x800a138f - JavaScript runtime error: Unable to get property 'moving' of undefined or null reference

stop: function () { var settings = $(this).data('settings'); if (settings.moving) { ###################### settings is undefined settings.moving = false; return this.each(function () { if (cssTransitionsSupported) { var currentPosition = $(this).css(settings.direction); $(this).css('transition-duration', '0s').css(settings.direction, currentPosition); } else $(this).stop(); }); } },

This is how I initialize the ticker

$("#webticker").webTicker({ speed: 50, //pixels per second direction: "left", //if to move left or right moving: true, //weather to start the ticker in a moving or static position startEmpty: true, //weather to start with an empty or pre-filled ticker duplicate: false, //if there is less items then visible on the ticker you can duplicate the items to make it continuous rssurl: false, //only set if you want to get data from rss rssfrequency: 0, //the frequency of updates in minutes. 0 means do not refresh updatetype: "reset" //how the update would occur options are "reset" or "swap" });

And the button to stop it:

 $('.div-banner-ticker-clear').click(function () {
     //clear the ticker
     $('#webTicker').webTicker('stop');
 });

Any help will be appreciate it!

Thanks

galastur commented 9 years ago

ouch! found it...

$('#webTicker').webTicker('stop'); =====> should be: $('#webticker').webTicker('stop');