在IMG动画最大宽度[JQuery的] [英] Animate max-width on img [JQuery]
问题描述
我试图寻找一个解决方案,但找不到什么好东西。
我的定制我的一个朋友一个博客。在加载时,我希望所有的IMG公司的每个岗位有一个最大宽度和150像素最大高度。当用户按下在img,最大值应增加至500像素,这是很容易做到。我的code的问题是,我无法得到它的动画,这是我想要的。任何帮助在那里?
VAR cssObj = {'最大宽度':'500像素,最大高度:500像素;'}$(img目录)。点击(函数(){
$(本)的.css(cssObj);
});
我得到了它的工作,结合其他的答案的两个(去除最大宽度和放大器;最大高度在CSS- code)
VAR cssBegin = {'最大宽度':'250像素,最大高度:250像素;'};
$('IMG')的CSS(cssBegin);
VAR cssObj = {'最大宽度':'500像素,最大高度:500像素;'};
$(img目录)点击(函数(){$(本).animate(cssObj,'慢');});
I have tried looking for a solution, but can't find anything good.
I am customizing a blog for a friend of mine. When it loads, I want all the img's in each post to have a max-width and max-height of 150px. When the user pushes the img, the max-values should increase to 500px, which is easy enough. The problem with my code is that I can't get an animation on it, which I want. Any help out there?
var cssObj = {'max-width' : '500px','max-height' : '500px;'}
$("img").click(function(){
$(this).css(cssObj);
});
I got it working, combining two of the other answers (and removing max-width & max-height in the css-code)
var cssBegin = {'max-width' : '250px','max-height' : '250px;'};
$('img').css(cssBegin);
var cssObj = {'max-width' : '500px','max-height' : '500px;'};
$("img").click(function(){ $(this).animate(cssObj,'slow'); });
这篇关于在IMG动画最大宽度[JQuery的]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!