2013-09-04 2 views
2

나는이 슬라이더를 WordPress 테마에서 작동하지 않습니다. 나는 모든 설정을 올바르게했고 슬라이드하지 않습니다. 자동 또는 수동. 내가 보았던 것에서는 정확한 것이있는 것처럼 보입니다. 나는 또한 모든 제조업 자의 지시 사항을 따라 왔지만 그것을 분류 할 수는 없다. www.casavulturului.com자바 스크립트 슬라이더가 작동하지 않습니다.

<?php if (!$paged && get_option('woo_featured') == "true") { ?> 
<script type="text/javascript"> 
    jQuery(document).ready(function(){ 
jQuery("#loopedSlider").loopedSlider({ 
<?php 
    $autoStart = 0; 
    $slidespeed = 600; 
    if (get_option("woo_slider_auto") == "true") 
     $autoStart = get_option("woo_slider_interval") * 1000; 
    else 
     $autoStart = 0; 
    if (get_option("woo_slider_speed") <> "") 
     $slidespeed = get_option("woo_slider_speed") * 1000; 
?> 
    autoStart: <?php echo $autoStart; ?>, 
    slidespeed: <?php echo $slidespeed; ?>, 
    autoHeight: true 
}); 
}); 
</script> 
<?php } ?> 
<div id="sliderWrap"> 
<div class="innerwrap"> 
<div id="loopedSlider"> 
<?php $img_pos = get_option('woo_featured_img_pos'); ?> 
<?php $saved = $wp_query; query_posts('suppress_filters=0&post_type=slide&order=ASC&orderby=date&showposts=20'); ?> 
<?php if (have_posts()) : $count = 0; $postcount = $wp_query->post_count; ?> 


<div class="container"> 

    <div class="slides"> 

     <?php while (have_posts()) : the_post(); ?> 
     <?php if (!woo_image('return=true')) continue; // Don't show slides without image ?> 
     <?php $count++; ?> 

     <div id="slide-<?php echo $count; ?>" class="slide"> 

      <div class="slide-content <?php if($img_pos == "Left") { echo "fr"; } else { echo "fl"; } ?>"> 

       <h2 class="slide-title"> 
        <a href="<?php the_permalink() ?>" rel="bookmark" title="<? php the_title(); ?>"><?php the_title(); ?></a> 
        <?php if ($postcount > 1) echo '<span class="controlsbg">&nbsp;</span>'; ?> 
       </h2> 

       <p><?php the_content(); ?></p> 

      </div><!-- /.slide-content --> 

      <?php if (woo_image('return=true')) { ?> 
      <div class="image <?php if($img_pos == "Left") { echo "fl"; } else { echo "fr"; } ?>"> 
       <?php woo_image('width=515&height=245&class=feat-image&link=img'); ?> 
      </div> 
      <?php } ?> 

      <div class="fix"></div> 

     </div> 

     <?php endwhile; ?> 

    </div><!-- /.slides --> 
    <?php if($count > 1) { ?> 
     <ul class="nav-buttons <?php if($img_pos == "Left") { echo "right"; } else { } ?>"> 
      <li id="p"><a href="#" class="previous"></a></li> 
      <li id="n"><a href="#" class="next"></a></li> 
     </ul> 
    <?php } ?> 

</div><!-- /.container --> 

<div class="fix"></div> 

<?php else : ?> 
    <p class="note"><?php _e('Please add some "Slides" to the featured slider.', 'woothemes'); ?></p> 
<?php endif; $wp_query = $saved;?> 
</div><!-- /#loopedSlider --> 
</div> 
</div><!-- /#sliderWrap --> 

JQUERY 코드 :

(기능 (jQuery를) { jQuery.fn.loopedSlider = 기능 (옵션) {

var defaults = {    
    container: '.container', 
    slides: '.slides', 
    pagination: '.pagination', 
    containerClick: false, // Click container for next slide 
    autoStart: 0, // Set to positive number for auto start and interval time 
    restart: 0, // Set to positive number for restart and restart time 
    slidespeed: 100, // Speed of slide animation 
    fadespeed: 100, // Speed of fade animation 
    autoHeight: false // Set to positive number for auto height and animation speed 
}; 

this.each(function() { 

    var obj = jQuery(this); 
    var o = jQuery.extend(defaults, options); 
    var pagination = jQuery(o.pagination+' li a',obj); 
    var m = 0; 
    var t = 1; 
    var s = jQuery(o.slides,obj).children().size(); 
    var w = jQuery(o.slides,obj).children().outerWidth(); 
    var p = 0; 
    var u = false; 
    var n = 0; 
    var interval=0; 
    var restart=0; 

    jQuery(o.slides,obj).css({width:(s*w)}); 

    jQuery(o.slides,obj).children().each(function(){ 
     jQuery(this).css({position:'absolute',left:p,display:'block'}); 
     p=p+w; 
    }); 

    jQuery(pagination,obj).each(function(){ 
     n=n+1; 
     jQuery(this).attr('rel',n); 
     jQuery(pagination.eq(0),obj).parent().addClass('active'); 
    }); 

    if (s!=1) { // WooThemes add 
    jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:-w}); 
    } // WooThemes add 

    if (s>3) { 
     jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:-w}); 
    } 

    if(o.autoHeight){autoHeight(t);} 

    jQuery('.next',obj).click(function(){ 
     if(u===false) { 
      animate('next',true); 
      if(o.autoStart){ 
       if (o.restart) {autoStart();} 
       else {clearInterval(sliderIntervalID);} 
      } 
     } return false; 
    }); 

    jQuery('.previous',obj).click(function(){ 
     if(u===false) { 
      animate('prev',true); 
      if(o.autoStart){ 
       if (o.restart) {autoStart();} 
       else {clearInterval(sliderIntervalID);} 
      } 
     } return false; 
    }); 

    if (o.containerClick) { 
     jQuery(o.container ,obj).click(function(){ 
      if(u===false) { 
       animate('next',true); 
       if(o.autoStart){ 
        if (o.restart) {autoStart();} 
        else {clearInterval(sliderIntervalID);} 
       } 
      } return false; 
     }); 
    } 
+1

약간 주제에서 벗어난,하지만 당신은 jQuery를-UI 슬라이더를 시도? http://jqueryui.com/slider/ –

+0

관련 코드 만 포함하도록 게시물을 업데이트 해 주실 수 있습니까? – tborychowski

+0

문제는 javascript 코드에서 제공 될 가능성이 큽니다. javascript를 표시하십시오. '잡히지 않은 오류 : 구문 오류, 인식 할 수없는 표현 : [object Object] [rel = "2"]'<- 이것은 당신의 문제 일 수 있습니다. –

답변

2

당신에게 여기 웹 사이트입니다 '은 "#loopedslider"요소에 슬라이드를 사용하여 재 :

jQuery("#loopedSlider").loopedSlider({ 

그러나 사업부는 contai를 보유하고 슬라이드 자체 대신에 슬라이드를 사용할 수 있습니다. 슬라이드를 유지하는 요소에 슬라이더가 1)를 제거 컨테이너 또는 2) 스위치 : 그래서 당신은 두 가지 옵션이 있습니다

jQuery(".slides").loopedSlider({ 
+0

정말 고마워요! 나는 그것을 시도하고 돌아올 – Andra

+0

안녕하세요. 그래서 스크립트를 봤고 div에서 슬라이드를 볼 수 있습니다. 컨테이너는 div의 클래스 일뿐입니다. 그것 없이는 슬라이더가 오른쪽으로 페이지가 매겨지지 않습니다. 그래서이 시점에서 나는 문제가 무엇인지 알지 못한다. – Andra

+0

코드를 더 이상 볼 수 없습니다 : 플래시 슬라이더로 교체 했습니까? – Wietse

관련 문제