我是靠谱客的博主 明亮萝莉,这篇文章主要介绍jQuery的click和on方法(参数如果用箭头函数,就不起效果,参数只能用原生写,写jQuery轮播图试出来的)...,现在分享给大家,希望可以做个参考。


$('#focus li').click(function(){
var curIndex=$(this).index();
step=curIndex;
renderImgs();
renderFocus();
});
复制代码
//第一种情况
$('#focus li').click(function(){//如果变成箭头函数的话就不起效果
var curIndex=$(this).index();
step=curIndex;
renderImgs();
renderFocus();
});
//第二种情况
$('#focus li').on('click',function(){//如果变成箭头函数的话就不起效果
var curIndex=$(this).index();
step=curIndex;
renderImgs();
renderFocus();
});
复制代码

最后

以上就是明亮萝莉最近收集整理的关于jQuery的click和on方法(参数如果用箭头函数,就不起效果,参数只能用原生写,写jQuery轮播图试出来的)...的全部内容,更多相关jQuery内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(125)

评论列表共有 0 条评论

立即
投稿
返回
顶部