2013-02-03 68 views
0

我使用Drupal和jQuery說.animation is not a function。爲什麼我得到這個錯誤?。動畫不是函數

(function($){ 
    var cg_parent = "#block-views-content_gallery-cg_block"; 
    var cg_items = cg_parent + " ul"; 
    var cg_item = cg_items + " li"; 

    $(cg_item + ".views-row-first div.cg_item").addClass("active"); 
    $(cg_item + ".views-row-first div.cg_item").bind("mouseenter", function() { 
     $("div.cg_item.active div.cg_body_content").animation({ left: '100px' }, 100, function() { 
      alert("je;;p"); 
     }); 
    }); 
})(jQuery); 

http://jsfiddle.net/seejee/sYFR9/7/

+1

jQuery對象具有「動畫」方法而不是「動畫」。 – undefined

回答

1

的方法被命名爲animateanimation

$("div.cg_item.active div.cg_body_content").animate({ left:'100px' }, 100, function() { 
    alert("je;;p"); 
}); 
0

嘗試,

//content gallery js file 

(function($){ 
       var cg_parent = "#block-views-content_gallery-cg_block"; 
       var cg_items = cg_parent+" ul"; 
       var cg_item = cg_items+" li"; 

       $(cg_item+".views-row-first div.cg_item").addClass("active"); 
       $(cg_item+".views-row-first div.cg_item").bind("mouseenter",function(){ 

        $("div.cg_item.active div.cg_body_content").animate{left:'100px'}, 100, function(){alert("je;;p");}); 
       }); 
})(jQuery); 
0

animate取代animation,這將做的工作:)