2013-04-02 6 views
5

별도의 페이지 대신 모달 상자에 새 게시물을 여는 Wordpress 테마를 개발 중입니다.jQuery주기 플러그인이 모달 상자 내부에서 작동하지 않습니다. (단순 모달 플러그인)

각 게시물 (jQuery Cycle Plugin)의 이미지를 표시하는 데 사용하는 이미지 슬라이드 쇼 플러그인은 게시물이 자체 페이지에있을 때 유용하지만, Simple Modal 플러그인을 사용하면 슬라이드 쇼 대신 목록에 이미지가 표시됩니다 내 레이아웃이 완전히 깨졌습니다. 여기

게시물은 그 자체의 모습입니다 (슬라이드 쇼를 사전에 이미지를 클릭) : http://cl.ly/240c3C0i1m1o

당신은 내가 고유 한 URL의 코딩하지 않은 방법 모달 작품 (본 페이지의 첫 번째 썸네일을 클릭 할 수

아직 모달의 경우) : 링크를 클릭하여 모달 콘텐츠를로드하기 전에 jQuery Cycle 플러그인이 페이지에 적용되므로 jQuery Cycle 플러그인이 모달 상자에서 작동하지 않는다고 가정합니다. 나는 정말로 모른다.

도움을 주시면 감사하겠습니다. 이 답을 사용하여 모달 상자 구현에 도움이되었습니다 : Using simplemodal with wordpress. 아래 주제와 관련된 코드를 포함 시켰습니다.

이 내 header.php 파일에 다음을 얻을 수 functions.php 내가이이

$(document).ready(function() { $('.product-images').cycle({ 
    fx:  'none', 
    next: '.slide', 
    timeout: 0 
}); }); 

:

<?php 
     wp_enqueue_script('jquery.cycle.all.min.js', '/wp-content/themes/Goaty%20Tapes%20Theme/js/jquery.cycle.all.min.js', array('jquery')); 
     wp_enqueue_script('product-slideshow', '/wp-content/themes/Goaty%20Tapes%20Theme/js/product-slideshow.js'); 
?> 

product-slideshow.js에 포함되어 있는지입니다 (사이클 플러그인에 대한 설정을 시작합니다) 모달 작업 :

function my_print_scripts() { 
     if (!is_admin()) { 
      $url = get_bloginfo('template_url'); 
      wp_enqueue_script('jquery-simplemodal', 'http://66.147.244.226/~goatytap/wp-content/themes/Goaty%20Tapes%20Theme/js/jquery.simplemodal.1.4.1.min.js', array('jquery'), '1.4.1', true); 
      wp_enqueue_script('my_js', 'http://66.147.244.226/~goatytap/wp-content/themes/Goaty%20Tapes%20Theme/js/site.js', null, '1.0', true); 
     } 
    } 
    add_action('wp_print_scripts', 'my_print_scripts'); 

이것은 내에 있습니다.파일 :

jQuery(function ($) { 
    $('a.popup').click(function(){ 
     id = this.rel; 
     $.get('http://66.147.244.226/~goatytap/ajax-handler/?id='+id, function (resp) { 
      var data = $('<div id="ajax-popup"></div>').append(resp); 
      // remove modal options if not needed 
      data.modal({ 
       overlayCss:{backgroundColor:'#FFF'}, 
       containerCss:{backgroundColor:'#fff'} 
      }); 
     }); 
     return false; 
    }); 
}); 

답변

11

문서 준비가 완료되면주기가 초기화됩니다. 모달 쇼에서 초기화해야합니다.

data.modal({ 
      overlayCss:{backgroundColor:'#FFF'}, 
      containerCss:{backgroundColor:'#fff'}, 
      onShow: function (dialog) { 
       $('.product-images').cycle({ 
        fx:  'none', 
        next: '.slide', 
        timeout: 0 
       }); 

      } 
     }); 
같은 자신의 documentation

onShow [Function:null] 
The callback function used after the modal dialog has opened 

뭔가를 확인