admin管理员组文章数量:1355661
I am looking for a solution for a single line Marquee horizontal text scroll with a fading effect using javascript (jquery if possible). Like a carousel text scroll. All the google searches gave me scrolling effects but with no fading effect.
I know that this can be done in flash but im avoiding it if there are other solutions.
Any help would be greatly appreciated.
I am looking for a solution for a single line Marquee horizontal text scroll with a fading effect using javascript (jquery if possible). Like a carousel text scroll. All the google searches gave me scrolling effects but with no fading effect.
I know that this can be done in flash but im avoiding it if there are other solutions.
Any help would be greatly appreciated.
Share Improve this question edited May 6, 2010 at 15:30 skaffman 404k96 gold badges824 silver badges775 bronze badges asked May 6, 2010 at 15:14 PeterPeter 231 gold badge1 silver badge3 bronze badges2 Answers
Reset to default 3<html>
<head>
<style>
#marquee{
position: absolute;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
function marqueePlay(){
$("#marquee").animate(
{
left: $(window).width() - $("#marquee").width(),
opacity: 0
}, 10000, function(){
$("#marquee").css("left", 0);
$("#marquee").css("opacity", 1);
marqueePlay();
}
);
}
marqueePlay();
});
</script>
</head>
<body>
<div id="marquee">Weee...Weee...Duh!</div>
</body>
</html>
One way you can do this is by creating a marquee and floating a semi-transparent image at its edge:
Any of the ones you found are fine, or use this one built in jQuery: http://remysharp./demo/marquee.html
Here's a fading image: http://www.collylogic./scripts/fade.png
Here's the source where you can see actually SEE the fading effect on the above image
The advantages of doing it this way is that you're not doing any expensive processing in javascript. You also have a wider variety of scrolling to choose from without having to worry about when or where to fade.
The disadvantage is that semi-transparent pngs need a hack to work in IE6. But since it's just eye candy, I'd imagine those few IE6 users won't be impacted that much.
本文标签: javascriptMarquee horizontal text scroll with a fading effectStack Overflow
版权声明:本文标题:javascript - Marquee horizontal text scroll with a fading effect? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743989356a2571847.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论