简体   繁体   中英

Clean Javascript marquee not working at chrome

i have a marquee element which only shows when the element is visible, in firefox working perfect, in chrome the marquee work one time and stop. any idea?

code:

var isRoomElement = document.getElementsByTagName('body'); 
    if (isRoomElement.length) {
        var elem = document.createElement('marquee');
        elem.id='mngLinksMenu';
        elem.style.cssText = 'position:absolute;text-shadow:1px 1px #FFFFFF;bottom:0px;padding:8px;width:100%;height:27rem;z-index:1000;white-space:nowrap;color:black;text-align:justify;';
        elem.setAttribute("scrollAmount", 15);
        elem.setAttribute("direction", 'left');
        elem.setAttribute("behavior", "scroll");
        elem.setAttribute("loop","2");

http://jsfiddle.net/nojLm938/

The marquee element is obsolete, as per the mdn docs. I would suggest looking for a different solution as browsers will no longer be making sure that this element works consistently.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee

You would be better to look at css transforms and overflow hidden and animate this yourself with keyframes. This will be much more consistent for you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM