[英](Bootstrap) Responsive image over button on hover?
I am trying to have an image show up over a button while hovering. 我正在尝试在悬停时将图像显示在按钮上。 I know that for Bootstrap, I can add the
.img-responsive
class while declaring the image in the HTML, but I cant seem to get it working properly with how I was trying to load the images. 我知道对于Bootstrap,我可以在声明HTML中的图像的同时添加
.img-responsive
类,但我似乎无法正确地使用它如何加载图像。 The buttons themselves are already responsive. 按钮本身已经响应。 I was using a couple blocks of CSS and preloading the images through the CSS.
我使用了几块CSS并通过CSS预加载图像。 Whats the best way to go about this?
什么是最好的方式来解决这个问题?
Also, is there a way to add some sort of animation to show the image? 另外,有没有办法添加某种动画来显示图像? Like have the image scroll up from the bottom of the button?
就像图像从按钮底部向上滚动一样?
Ever take a look at what .img-responsive
does? 曾经看过
.img-responsive
什么作用? It doesn't do much. 它没有做太多。 I recommend you override the class and apply the actual responsive design you think will work best for your site.
我建议您覆盖课程并应用您认为最适合您网站的实际响应式设计。
Taken from boostrap.css : 取自boostrap.css :
.img-responsive{
display: block;
max-width: 100%;
height: auto;
}
You can also use the following if you already know how your image is supposed to look at certain screen sizes 如果您已经知道图像应该如何查看某些屏幕尺寸,也可以使用以下内容
@media screen and (min-width:500px) {
.img-responsive{
//...
}
}
For the animation. 对于动画。 You can intially set it to hidden and wait for the image to finish loading.
您可以将其初始设置为隐藏并等待图像完成加载。 Then you can do
$(#imageId).show("fast");
然后你可以做
$(#imageId).show("fast");
(or "slow"). (或“慢”)。 Or if you want to control your animation fully then I suggest you follow the jquery doc on how to do that.
或者如果你想完全控制你的动画,那么我建议你按照jquery文档来说明如何做到这一点。 http://api.jquery.com/animate/
http://api.jquery.com/animate/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.