我正在尝试将 Youtube API 与 jQuery Anythingslider 绑定,并且我正在实现它。
现在,我需要将在anythingslider 中定义的变量“ newState ”(在Youtube API 的“onPlayerStateChange”中)传递到它的回调中。这是代码,首先是变量,然后是anythingslider:
function onPlayerStateChange(newState) {
....
// other stuff not important
....
}
jQuery.(document).ready(function() {
jQuery('#myslider').anythingSlider({
easing : "swing",
width : 500,
............
............
onSlideComplete : function(){
jQuery('.button').click(function(){
if (newState == '3') {....}
});
}
});
});
这段代码返回给我:“newState”未定义..显然..非常感谢