javascript 将不断变化的图像添加到主页
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7465752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding a changing image to homepage
提问by AndyNZ
Hey guys I'm designing a website for my mothers backpackers business and currently I have set up a basic template for my webpages. On my homepage I am wanting to have an image that cycles through about 3 or 4 photos.
大家好,我正在为我母亲的背包客业务设计一个网站,目前我已经为我的网页设置了一个基本模板。在我的主页上,我想要一个循环显示大约 3 或 4 张照片的图像。
For example like this webpage here: http://www.qsb.co.nz/
例如像这里的网页:http: //www.qsb.co.nz/
What is the best way to go about doing this? I noticed in the markup it said it was a javascript? I'm at the end of my second year studying CS at uni so I can code in java and C - is this much different?
这样做的最佳方法是什么?我在标记中注意到它说它是一个 javascript?我在大学学习 CS 的第二年末,所以我可以用 Java 和 C 编写代码 - 这有很大不同吗?
How would I go about:
我该怎么办:
- Coding a script to cycle through 3 or 4 images. Which language / technique is best?
- Including this script in my webpage.
- 编写脚本以循环显示 3 或 4 个图像。哪种语言/技术最好?
- 在我的网页中包含此脚本。
Thanks in advance for your answers guys this website has been very very helpful so far.
提前感谢你们的回答,这个网站到目前为止非常有帮助。
回答by AndyNZ
Wesley Murch is right - jQuery (a Javascript framework) is the best recommended way to accomplish what you want.
Wesley Murch 是对的 - jQuery(一个 Javascript 框架)是完成你想要的最好的推荐方式。
I would recommend either ppshein's link or Medien Fruede's innerFade: http://medienfreunde.com/lab/innerfade/
我会推荐 ppshein 的链接或 Medien Fruede 的 innerFade:http://medienfreunde.com/lab/innerfade/