我在做什麼錯了?我想動畫的高度
$(".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