注册 登录
编程论坛 JavaScript论坛

请教jquery插件参数如何传出?是传出哦!

dkp88 发布于 2015-01-02 23:42, 506 次点击
程序代码:


<html xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="http://code.(function($){
  $.fn.mycj1=function(cs){
    var def={
      current:function(i){}
    }
    var cs=$.extend({},def,cs);
    $(this).click(function(){
      //alert($(this).index());
      /*请教这里如何将$(this).index()值回调传出去给current的function(index),然后用户通过判断index的状态来执行其它自定义函数*/
    })
  }
})(jQuery);

$(function(){
  $('div').mycj1({
    current:function(index){
      alert(index);
      if (index==1) alert('点了第2个');
    }
  });
})
</script>
</head>

<body>
<div>点我1</div>
<div>点击2</div>
</body>
</html>



请教各路大神,就如fullPage回调函数时这样!

只有本站会员才能查看附件,请 登录
0 回复
1