【发布时间】:2014-03-06 08:20:24
【问题描述】:
我正在寻找包含关键词的小段信息。当关键字悬停在 gif 上时,会在弹出框中播放 - 参见图片 (http://imgur.com/SK37Ikc)
我正在谈论的一个例子(有点)是http://imgur.com/gallery/Gh9UR70 看看 cmets 并将鼠标悬停在 gif 上(#8 左右)。我想做同样的事情。我的编程经验非常有限,不需要将其构建到整个网页中,只需将其放在另一个页面的一小部分中即可。
提前感谢您的帮助!
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function(){
$('#img_wrap').mouseover( function() {
$(this).toggleClass('animated', 'static');
})
})
</script>
<style>
.animated #static, .static #animated {
display: none;
}
.animated #animated, .static #static {
display: inline;
}
</style>
</head>
<body>
<div id="img_wrap" class="static">
Big long write up would go here with various key words being spaced throughout that I would like to play gifs on mouse over.
<img id="animated" src="http://i.imgur.com/MgYashD.gif" alt="">
</div>
</body>
【问题讨论】: