希望我的措辞正确......
我正在尝试将元素 id 作为 jquery 函数中的选项传递:
$('.carousel').createcarousel({
theid: $(this).attr('id'), // this is the part I am trying to get working
delay: 150,
fade:300,
slide: 700,
effect:'slide',
orientation:'horizontal',
loop: false,
autoplay: false });
在函数本身中,选项定义为o
,所以我可以执行以下操作:
alert(o.fade);
它将显示一个显示“300”的警报。但是,如果我这样做:
alert(o.theid);
它说未定义。为什么?