我在做什么错了?我想动画的高度
$(".thumbnail").on('click', function(){
$(this).animate({height:500},1500);
});
});
的jsfiddle:http://jsfiddle.net/PUdSn/
我在做什么错了?我想动画的高度
$(".thumbnail").on('click', function(){
$(this).animate({height:500},1500);
});
});
的jsfiddle:http://jsfiddle.net/PUdSn/
你有你的样品中的额外});
。这里修好了: http://jsfiddle.net/PUdSn/5/
的代码应该是:
$(".thumbnail").on('click', function(){
$(this).animate({height:"500px"},1500); //adding the px makes it clearer
});
没什么只是一个错字:你在你的演示有额外});
$(".thumbnail").on('click', function(){
$(this).animate({height:500},1500);
});
}); // remove those!
有缺少一个右支架和你错过$(document).ready (function() { ... }
$(document).ready(function() {
$(".thumbnail").on('click', function() {
$(this).animate({
height: 500
}, 1500);
});
});
工作DEMO
@KirkWoll你点击了,它没有动画?它适合我这里。 – 2012-03-02 19:34:42
呃,当然点击! – 2012-03-02 19:36:45
正如其他人所说,你只有在一个错字,你有一个额外的});
。这并没有改变任何东西,但是你可以去掉on,直接设置click()方法。
$(".thumbnail").click(function(){
$(this).animate({height:"500px"},1500);
});
而且,以供将来参考,这是很容易使用某种Web开发人员工具包的捕获。在IE中它是内置的,你只需要打F12。在Chrome中内置,你只需要按Ctrl + Shift + I。而且,在Firefox中,我不相信它是内置的,但是您可以使用firebug和/或web dev作为扩展。希望这可以帮助未来的调试:)
这是对的,但在你的小提琴中的尾部}};'是错误的。 – 2012-03-02 19:36:05