2014-01-21 5 views
-5

WordPress에서 슬라이더를 만들려고합니다.잡히지 않은 TypeError : Object [object Object]에 'carouFredSel'메서드가 없습니다.

<?php 

    // Enqueue Flexslider Files 
    function wd_slider_scripts() { 
      //wp_enqueue_script('jquery'); 

      wp_enqueue_style('carouFredSel-style', get_template_directory_uri() . '/inc/client_slider/css/style.css'); 

      wp_enqueue_script('carouFredSel-script', get_template_directory_uri() . '/inc/client_slider/js/jquery.carouFredSel-6.1.0-packed.js', array('jquery'), false, true); 
      wp_enqueue_script('touchSwipe-script', get_template_directory_uri() . '/inc/client_slider/js/jquery.touchwipe.1.1.1.js', array('jquery'), false, true); 
    } 
    add_action('wp_enqueue_scripts', 'wd_slider_scripts'); 

    // Initialize Slider 
    function wd_slider_initialize() { ?> 
      <script type="text/javascript"> 
       jQuery('#partners-slider .slider-holder2').carouFredSel({ 
        align: 'center', 
        items: { 
         visible: "variable", 
         width: "variable" 
        }, 
        scroll: 1, 
        prev: ".prev-arr", 
        next: ".next-arr" 
       }); 
      </script> 
    <?php } 
    add_action('wp_footer', 'wd_slider_initialize'); 

    // Create Client Slider 
    function wd_client_template() { 

      // Query Arguments 
      $args = array(
        'post_type' => 'clients', 
        'posts_per_page' => 5 
      );  

      // The Query 
      $the_query = new WP_Query($args); 

      // Check if the Query returns any posts 
      if ($the_query->have_posts()) { 

       // Start the Client Slider ?> 
       <section></section> 

       <section class="partners"> 

       <div id="partners-slider"> 
        <div class="caroufredsel_wrapper" style="display: block; text-align: start; float: none; position: relative; top: auto; right: auto; bottom: auto; left: auto; z-index: auto; width: 100%; height: 52px; margin: 0px; overflow: hidden;"> 
         <div class="slider-holder2" style="text-align: left; float: none; position: absolute; top: 0px; right: auto; bottom: auto; left: -188.89493620243093px; margin: 0px; width: 4105px; height: 52px; z-index: auto;"> 

            <?php 
            // The Loop 
            while ($the_query->have_posts()) : $the_query->the_post(); ?> 

              <?php echo the_post_thumbnail(); ?> 

            <?php endwhile; ?> 

         </div> 
        </div> 
       </div> 

       <div class="slider-arr"> 
        <a class="prev-arr arr-btn" href="#" style="display: block;"></a> 
        <a class="next-arr arr-btn" href="#" style="display: block;"></a> 
       </div> 

       </section> 

      <?php } 

      // Reset Post Data 
      wp_reset_postdata(); 
    } 

내가 오류에 직면하고있다 : 여기에 내가 사용하고 코드입니다

Uncaught TypeError: Object [object Object] has no method 'carouFredSel'

+0

지금까지 시도한 것은 무엇입니까? 어떤 부분이 오류의 원인인지 정확하게 찾아 내기 위해 코드를 좁혔습니까? 문맥은 무엇입니까? 플러그인을 설치 했습니까? – Sam

답변

0
오류 코드가 뭔가에 carouFredSel라는 메소드를 호출하려고하지만, 방법을 나타내는되는

존재하지 않습니다. 그래서

$('#carousel').carouFredSel(); 

내 생각을 :

jQuery('#partners-slider .slider-holder2').carouFredSel({ /* ... */ }); 

The documentation for carouFredSel 당신이 올바르게 사용하고 있는지 표시하는 것 같다 코드를 보면, 난 당신이 jQuery를 객체에 메소드를 호출하려고했습니다 볼 수 있습니다 가장 먼저 확인해야 할 것은 the documentation에 표시된대로 스크립트를 실제로 포함했는지 여부입니다.

<script src="jquery.carouFredSel.js" type="text/javascript"></script> 
관련 문제