简体   繁体   English

将鼠标悬停在图上并更改无花果标题吗?

[英]Hover over figure and change fig caption?

I'm following this tutorial: http://tympanus.net/codrops/2013/06/18/caption-hover-effects/ . 我正在关注此教程: http : //tympanus.net/codrops/2013/06/18/caption-hover-effects/ Going in it step by step so I know what i'm doing. 一步一步地去做,所以我知道我在做什么。 I was surprised to learn this effect is done all in css. 我惊讶地发现这种效果是在CSS中完成的。

Anyway I got stuck at this part in cs-style3 无论如何,我在CS-style3中被困在这一部分

.no-touch .cs-style-3 figure:hover figcaption,
.cs-style-3 figure.cs-hover figcaption {
    opacity: 1;
    transform: translateY(0px);
    transition: transform 0.4s, opacity 0.1s;
}

What is .cs-hover? 什么是.cs-hover? I search for this is this some kind of special css3 thing? 我搜索这是某种特殊的CSS3东西吗? Because it isnt' a class in the file. 因为它不是文件中的类。 And I can't get this to work. 而且我无法使它正常工作。

I'm trying to hover over the figure/img and the figcaption is suppose to slide up. 我试图将鼠标悬停在图/ img上,figcaption应该滑上去。

I was thinking of trying figure:hover figcaption{} but this doesn't work either 我当时正在考虑尝试Figure:hover figcaption {},但这也不起作用

On the demo page there are a lot of examples. 在演示页面上,有很多示例。 The author used the .cs-style-"number" class to differentiate bewteen the different styles. 作者使用.cs-style-“ number”类在不同样式之间进行区分。

在此处输入图片说明

This means you should add the class to your code as well, just like in the inspector in the image above. 这意味着您也应该将该类添加到您的代码中,就像上图中的检查器一样。 I hope this helps you, otherwise leave a comment and we'll see if we can help you further 希望对您有所帮助,否则请发表评论,我们将看看是否能为您提供进一步的帮助

If you go through the code you'll see that they include <script src="js/toucheffects.js"></script> . 如果您浏览这些代码,将会看到它们包含<script src="js/toucheffects.js"></script> This script says: 该脚本说:

// for touch devices: add class cs-hover to the figures when touching the items //对于触摸设备:触摸项目时,将cs-hover类添加到图形中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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