2013-06-07 3 views
0

클릭하면 뒤집을 때까지 기다렸다가 지연시킨 다음 fancybox로 팝업합니다. 지연 후 fancybox를 실행시키기 위해 알아낼 수있는 유일한 방법은 지연된 플러그인과 .trigger ('클릭')를 사용하여 지연 후에 실행하는 것입니다. 문제는 계속해서 .trigger ('클릭')을 계속해서 발사하는 것이고 다른 모든 것을 죽이는 .off()가 없으면 멈추는 방법을 찾을 수 없다는 것입니다. 나는 정말로 약간의 제안에 감사 할 것이다.아무도 내 .trigger ('클릭')가 fancybox 이벤트를 계속해서 발사하는 것을 막을 수있는 방법을 찾아 낼 수 있습니까?

Live example

<script type="text/javascript"> 
jQuery.noConflict(); 

// First Home Page Popout Box 
jQuery(document).ready(function() { 
    jQuery('#card-processing-link').live('click', function() { 
     jQuery('#card-processing-box').flip({ 
       'direction' : 'lr', 
       speed  : '300' 
     }); 
    });  
    //Fancybox popout event 
    jQuery('#card-processing-link').delayed('click', 400, function(){   
       jQuery(this).trigger('click').fancybox({ 
       'onStart'   : function(){ 
            jQuery('#card-processing-box').hide(); 
            jQuery('#card-processing-popout').show(); 
            }, 
       'transitionIn' : 'elastic', 
       'transitionOut' : 'fadeOut', 
       'speedIn'  : 300, 
       'speedOut'  : 500, 
       'width'   : '420', 
       'height'   : 'auto', 
       'scrolling'  : 'no', 
       'centerOnScroll' : 'true', 
       'overlayColor' : 'transparent', 
       'onClosed'  : function(){ 
           jQuery('#card-processing-popout').hide(); 
           jQuery('#card-processing-box').fadeIn(); 

              }    
     }); 
    }); 
}); 
</script> 
+0

-1로 실행을 지연 할 setTimeout을 사용할 수 있습니다 : 당신은 이미 여기 http://stackoverflow.com/q/16966904/1055987 그 질문을 ... 답이 나오지 않았다면 좀 더 구체적인 질문이 필요 하겠지만 (같은 질문이 아니라면) 도움을 더 빨리 얻을 수 있다는 의미는 아닙니다. – JFK

답변

1

당신은 이미 클릭 한 경우 클릭 이벤트는,

jQuery(this).fancybox({

이 충분해야 트리거 싶어 ..

그렇지 않으면 당신은 무한 루프로 끝날 것입니다. 전자의 클릭 이벤트

당신은 나중에

jQuery.noConflict(); 

// First Home Page Popout Box 
jQuery(document).ready(function() { 
    jQuery('#card-processing-link').live('click', function() { 
     jQuery('#card-processing-box').flip({ 
      'direction': 'lr', 
      speed: '300' 
     }); 

     var $this = jQuery(this); 
     setTimeout(function() { 
      $this.fancybox({ 
       'onStart': function() { 
        jQuery('#card-processing-box').hide(); 
        jQuery('#card-processing-popout').show(); 
       }, 
        'transitionIn': 'elastic', 
        'transitionOut': 'fadeOut', 
        'speedIn': 300, 
        'speedOut': 500, 
        'width': '420', 
        'height': 'auto', 
        'scrolling': 'no', 
        'centerOnScroll': 'true', 
        'overlayColor': 'transparent', 
        'onClosed': function() { 
        jQuery('#card-processing-popout').hide(); 
        jQuery('#card-processing-box').fadeIn(); 

       } 
      }); 

     }, 400); 
    }); 
}); 
+0

나는 정확한 것을하려했지만 .fancybox가 이겼습니다. .trigger() 없이는 실행되지 않습니다. – user2460403

+0

왜 'fancybox'가 트리거를 필요로합니까? –

+0

방금 ​​setTimout 제안을 시도했으며 .trigger ('클릭 ')없이 .delayed를 사용하는 것과 동일한 기능을합니다. 어떤 이유로 든 .fancybox가 실행되지 않습니다. – user2460403