【发布时间】:2011-05-31 03:54:18
【问题描述】:
我试图让 jQuery 使用幻灯片而不是切换来制作动画。我的 HTML <head> 中包含这些文件:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
jQuery:
// $item is a list gathered as $('#gallery ul li') and all output to console as should
// $prev will be used to get current li width, but not to worry about for now.
$.fn.slider = function($item,$prev){
$item.each(function(i){
$(this).animate({width:'slide',left:'-= 500'});
});
};
我不明白的是,如果我将动画宽度从幻灯片更改为切换,它会起作用,但是对于幻灯片,什么也没有发生。我在 jsfiddle 进行了测试,幻灯片在那里工作。这是怎么回事?我错过了 jsfiddle 有什么?
编辑:这里是小提琴:http://jsfiddle.net/robx/ZvKUW/1/
【问题讨论】:
-
您是否尝试在启用了 Firebug 的 Firefox 中运行本地副本,以查看运行时是否有任何 javascript 错误?
-
我正在查看,是的,否则我不知道 $item 是否包含任何内容。
标签: javascript jquery jquery-animate