与图像幻灯片相对应的文本颜色变化
我在我的网站主页上循环播放投资组合项目图像的幻灯片。我还有一个包含所有项目名称的链接列表。是否可以按特定顺序更改文本颜色,以便在显示项目图像时,项目名称/链接突出显示?
如果是这样,将图像和文本一起制作动画是否有意义?或者将它们作为两个独立的函数,并正确计时以使它们对应?
谢谢!
I have a slideshow of portfolio project images playing in a loop on my site's homepage. I also have a list of links with names of all the projects. Is it possible to change text color in a specific sequence such that when a project image is displayed, the project name/link becomes highlighted?
If so, does it make sense to animate both the images and the text together? Or have them as two separate functions, and just time it correctly so they correspond?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解正确的话,您有一个在幻灯片中旋转的图像列表,您还有一个显示幻灯片中每个项目的标题/链接列表。
当相应的幻灯片图像处于活动状态时突出显示正确标题的一个好方法是使用幻灯片图像
id
sexample
下面是幻灯片图像列表。每个
li
都有一个唯一的id
,我们将使用它链接到相应的标题。以下是标题列表。
现在您已经有了基本的标记,您可以编写一个函数来检查幻灯片图像何时显示,然后获取该图像的 id
li
,并检查是否有任何li<标题的
ul
列表中的 /code> 具有该 id 作为它的类。如果是的话,它会向其中添加一个改变其颜色的类。
像这样的事情:
显然,我假设当前的幻灯片图像/li具有一类活动,但如果没有,这并不难做到。
此外,highlight 类将包含文本颜色的 css 属性。
抱歉,如果我偏离了目标!
If I'm understanding you correctly, you have a list of images that are rotating in a slideshow, you also have a list of titles/links that present each one of the items in the slideshow.
A good way to highlight the the correct title when the corresponding slideshow image is active , is to use the slideshow images
id
sexample
Below is your slideshow list of images. Each
li
has a uniqueid
which we will use to link to the corresponding titles.Below is the list of titles.
Now you have the basic mark up, you write a function that checks when a slideshow image is being displayed, it then gets the id of that image
li
, and checks whether any of theli
s within the title'sul
list has that id as it's class.If it does, it adds a class to it that changes its colour.
Something like this:
Obviously I am assuming that the current slideshow image/li has a class of active, but this wouldn't be hard to do if it didn't.
Also, the class of highlight will contain css properties of a text color.
Sorry if im way off the mark!