[英]Image pop-out on mouse hover
I had an image of a play button on my webpage I'm building with HTML but I have added some code and it has changed the image to a square or it created an image over my play button of a square. 我使用HTML构建的网页上有一个播放按钮的图像,但是我添加了一些代码,它已将图像更改为正方形,或者在正方形的播放按钮上创建了图像。
How do I rectify that and get the code to apply to my play button image? 我该如何纠正并获取适用于我的播放按钮图像的代码?
Also I want the image to pop outward when I hover the mouse over it, instead right now it goes inward. 另外,我希望将鼠标悬停在图像上方时图像向外弹出,而不是现在向内弹出。
HTML HTML
<a class="thumbnail" <IMG STYLE="position:absolute; TOP: 516px; LEFT:1233px; WIDTH:130px; HEIGHT:130px" SRC="play button.png"</a>
JQUERY JQUERY
$('.thumbnail').mouseover(function() {
$('.thumbnail').removeClass('hover');
$(this).addClass('hover');
});
CSS CSS
.thumbnail:hover, .thumbnail.hover {}
.thumbnail:hover span, .thumbnail.hover span {}
your html is not valid, silly. 您的html无效,很愚蠢。
<a class="thumbnail">
<IMG STYLE="position:absolute; TOP: 516px; LEFT:1233px; WIDTH:130px; HEIGHT:130px" SRC="play-button.png">
</a>
that should fix it 应该修复它
I'm not sure if I understand what you're looking for, but here's some VALID HTML and a working pop out on hover which you can adjust to your needs: 我不确定我是否了解您要查找的内容,但这是一些VALID HTML和悬停工作弹出框,您可以根据需要进行调整:
<a class="thumbnail">
<img src="http://randolph.k12.nc.us/schools/whs/buttons/teal-button-png.png" alt="" />
</a>
CSS goes like this (and edit at will): CSS像这样(并随意编辑):
.thumbnail:hover:after{content:'Hello!';background:#fc0; width:300px; height:100px; position: absolute; z-index:2; top:20px; left:30px;
}
.thumbnail:hover span, .thumbnail.hover span {
}
img {
position:absolute;
top: 0px;
left:0px;
width:200px;
height:130px
}
and you can see the fiddle here . 你可以在这里看到小提琴 。 Your JS isn't needed at all.
根本不需要您的JS。
As we're at it, please pay attention on the use of the img tag, and don't use spaces in file names. 就目前而言,请注意img标签的使用,并且不要在文件名中使用空格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.