zeeshan_haider000 Posted April 20, 2009 Share Posted April 20, 2009 Hi, what can be done to this script so it stops on mouseover and resume back on mouseout (stop sliding text on mouse over and resume on mouseover)? if (document.all || document.getElementById){ //if IE4 or NS6+ document.write('<style type="text/css">\n') document.write('.dyncontent{display: none; width: auto; height: 60px;}\n') document.write('</style>') } var curcontentindex=0 var messages=new Array() function getElementByClass(classname){ var inc=0 var alltags=document.all? document.all : document.getElementsByTagName("*") for (i=0; i<alltags.length; i++){ if (alltags[i].className==classname) messages[inc++]=alltags[i] } } function rotatecontent(){ //get current message index (to show it): curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0 //get previous message index (to hide it): prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1 messages[prevcontentindex].style.display="none" //hide previous message messages[curcontentindex].style.display="block" //show current message } window.onload=function(){ if (document.all || document.getElementById){ getElementByClass("dyncontent") setInterval("rotatecontent()", 2000) } } Also where can i find a script that will have the effects of like vertical sliding content? (update box/show recent things)? Help would highly appreciated. Regards, ZEe Quote Link to comment Share on other sites More sharing options...
taith Posted April 21, 2009 Share Posted April 21, 2009 personally... i would create a global boolian variable var pause=false; then in your rotating function if(pause==true) return; then you simply put an onmouseover/out pause=true/false; this way it will start rotating onload(when you set that part of the program up) and when you mouseover it, it'll pause, and mouseout it'll resume where it left off... this code may be rather raw... but i made something like this a LONG time ago... http://www.evergreengolfcentre.ca/ picture strip loads on default, scrolls when its done loading, pauses on mouseover, resumes on mouseout... seems like a comparable idea to yours... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.