1

我的一些页面工作,其中一些没有。那些不起作用的是具有自定义事件处理程序的那些。所有页面都有以下 jQuery 代码。

    var speed = 750;
    $(document).on("dialogopen", ".dialogClass", function() {
            var parent = $(this).parent();
            $(this).dialog("option", "width", $(window).width());
            $(this).dialog("option", "height", $(window).height());
            $(this).dialog("option", "position", [0,0]);
            $(this).dialog("option", "draggable", "false");
            parent.css("position","fixed");
            parent.css("top","0px");
            parent.css('left','-' + $(window).width() + 'px');
            parent.animate({
                    left: 0
            }, speed, "easeOutBounce");

    });

    $(document).on("dialogclose", ".dialogClass", function() {
            if($('#dialog').is(':data(dialog)')){
                    $(this).dialog("destroy");
                    $(this).swipe("destroy");
                    $(this).swipe({
                            swipeLeft:function(event, direction, distance, duration, fingerCount) {

                                    if(distance >= 200){
                                            var dia = $(this);
                                            $(this).parent().animate({
                                                    left : -$(window).width()
                                            },speed, "easeInExpo", function(e) {
                                                    dia.dialog("close");
                                            });
                                    }

                            }
                    });
            }

    });

一些对话框具有自定义的打开\关闭处理程序,例如(theDialog 属于类 dialogClass):

  $("#theDialog").dialog({
           width: 700,
           height:675,
           title:'Add Event',
           resizable:false,
           modal:true,
           close: function(event,ui{
                  $("#theDialog").html('');
                  //Do other things
  });

拥有两个关闭处理程序的 jQuery 是否合适?这些在任何形状或形式上是否相互冲突?如果是这样,我怎样才能让自定义事件处理程序以及全局类一触发。

4

0 回答 0