以前不可见元素的触发方法

triggering method on a formerly invisible element

本文关键字:方法 元素      更新时间:2023-09-26

我使用两个jquery插件SlideControl和iCheck,然后我使用这个脚本

$(document).ready(function(){
            $('.slideControl').slideControl({
                'lowerBound' : 1,
                'upperBound' : 10
            });
            $('.form-horizontal input').iCheck({
                checkboxClass: 'icheckbox_flat',
                radioClass: 'iradio_flat'
            });
            $("input").on("ifChecked",function(e){
                 $(this).parent().next().removeClass("invisible");
            });
});

$(this).parent().next()有类.slideControl,所以它应该显示为滑块,但它不起作用。仅供参考,ifChecked对应于为iCheck api定制的check事件。我试着添加

$("input").on("ifChecked",function(e){
          $(this).parent().removeClass("invisible");
          $('.slideControl').slideControl({
                    'lowerBound' : 1,
                    'upperBound' : 10
                });
});

它也不起作用。事实上,如果我把最后一段代码放在slidecontrol文件slideControl.min.js中,它就可以工作了。但是它不是很干净,有人能帮忙吗?

好吧,我明白了,这有点棘手:事实上,当ifChecked与检查事件不是真正同步时,所以我不得不这么做!

$("input").on("ifChecked",function(e){
                $(this).parent().addClass('checked');
                $(this).parent().removeClass("invisible");
      $('.slideControl').slideControl({
                'lowerBound' : 1,
                'upperBound' : 10
            });
            });