javascript - detect when an html element exits the screen -
i have marquee. (tag < marquee >). when first element (the span class "span1") stops being seen on screen, notify me.
<div id='container_marquee'> <marquee id='mymarquee' behavior="scroll" onmouseover="this.stop();" onmouseout="this.start();"> <span class='span1'>first marquee text</span> <span class='span2'>second marquee text</span> <span class='span3'>third marquee text</span> <span class='span4'>fourth marquee text</span> <span class='span5'>fifth marquee text</span> </marquee> </div>
for example.. :
alert("the first span not visible on screen");
i not want have set interval or something, maybe there more efficient way it. perhaps associate listening event or something.
you time , alert user when ticks finished.
var ticks = 0; var timeformarquee = 24; //how long takes marquee hit edge (seconds) var clock = function(){ ticks++; if(ticks === timeformarquee){ alert("the first span isn't visible on screen"); } }; window.setinterval(clock, 1000);
Comments
Post a Comment