下面兩個函數的工作原理是腳本化的,除了當我在其周圍添加函數next(){;}和函數prev(){'}來定義自定義函數時。定義jQuery函數
我在這裏做錯了什麼?
function next() {
$('#up').click(function() {
$("#two").prev().animate({height:'80%'}, 500);
});
;}
function prev() {
$('#down').click(function() {
$("#two").next().animate({height:'80%'}, 500);
});
;}
這是一個壞習慣惹使用prev(),next()將是等於例如jQuery的函數名名左右,改變你的名字別的東西然後再試一次。 – Gustav
及以上@gustav建議,你也需要調用這些函數,以綁定事件 – fcalderan