Github. It sounds like you haven't called the scrollFromSide() function from within the init() function and it is therefore being called from the startit() function. These functions are in place to stop the text from scrolling when a user moves their mouse over it. Look for the following line: timeout = setTimeout ("scrollFromSide()", 50); This is currently set to 50, which means that 50 milliseconds pass before the function is called. Or you have got the offset height wrong. Phil is the founder and administrator of #! Nice elegant and compact solution on the vertical scroll! I need this script to get rid from w2c validation. Is it correct or am i doing something else wrong? How to set the marquee scrolling speed? hi im not good with english and html. i cant understand everything. To verify that an element exists in the DOM you just need to use the .length property of a jQuery lookup. Hello im trying to make 2 buttons 1 pointing up and the other down the idea is that when i mouseover them the text moves the way they point and it speeds up and can we make the default scrolling from top to bottom??  * Set the stop variable to be false and call the marquee function. If anyone has any suggestions then I would be more than happy to try them out. You can see how the untouched marquees are jumpy to animate, even in the later browsers such as Firefox 3 and Safari - let alone IE6.Demonstration of jQuery Marquee This creates a buffer zone which makes the marquee look more natural, but not only that the height of the elements is worked out with the spacer classes in mind. 30/01/2007 - Added both vertical and horizontal scrolling. I wrote this code years ago and it was just a way of getting to grips with JavaScript at the time.Â. This article explains how to use a marquee with HTML and JavaScript. some text marqeeing up and down then mouse go in that text it stopped how it is in java script. You'll need to call the stop() function to stop it and the startit() function to start it. Thanks for the comment. Questions: Iâm trying to find a very simple and smooth, lightweight javascript or jquery marquee. Click and hold the mouse marquee speed slow Hover over to slow marquee speed -The new attributes. The JavaScript scroll was originally created by Netscape and is distributed using the Mozilla Public License. There are some important differences between local and global variables in JavaScript that will cause grey hairs if you don't know what's going on. Thanks. The init() function sets the overflow of the div to be hidden so that no scroll bar appears on it. Note: This post is over a year old and so the information contained here might be out of date. This specifies the type of scrolling of the marquee. The lower the setting, the smoother the scrolling, but it also lowers the speed, so here you have to compensate. It seems that by adding a call to clearTimeout() at the start of the scrolling function it stops JavaScript trying to set lots of setTimeout() calls and therefore call this function more and more times. Have you seen this behavior as well? It is quite easy. Why I should use your script, I think there is a simple way makin a marquee text, something like this: Could explain to me I use don't use that script? Right now it just stops when finished. I added init() funtion on my page like this. You don't have to use it if you don't want to. function calcSpeed(speed) { // Time = Distance/Speed var spanSelector = document.querySelectorAll('.marquee span'), i; for (i = 0; i < spanSelector.length; i++) { var spanLength = spanSelector[i].offsetWidth, timeTaken = spanLength / speed; spanSelector[i].style.animationDuration = timeTaken + "s"; } } ⦠Scrolling Speed. Realy a usefull codes for me ..thnx dude.. keepit up. I honestly wouldn't use this code. @Jackie - You have either missed out the last paragraph - the empty one. All i need to do is to put a content inside of it. For instance, in the code above I have set the height of the spacer tags to be 150px. Thanks. I must have done something simple wrong?! 7: loop. Phil is currently a Developer at Code Enigma. Thank you again! tag in your CSS. As this was within a CMS I had limited scope to just add my new event to the existing code, so I needed a way of pulling out the current jQuery events and then calling that event handler separately. Thnaks. I'm using the horizontal scroller and it will ONLY start once the cursor has gone over the marquee. The HTML