php - javascript slider not working -
i have slider in wordpress theme it's not working. have done settings right , won't slide. automatically or manually. see eveyrthing seems tobe correct. have followed manufacturer instructions can't seem sort out. here website: 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"> </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 "slides" featured slider.', 'woothemes' ); ?></p> <?php endif; $wp_query = $saved;?> </div><!-- /#loopedslider --> </div> </div><!-- /#sliderwrap -->
jquery code:
(function(jquery) { jquery.fn.loopedslider = function(options) {
var defaults = { container: '.container', slides: '.slides', pagination: '.pagination', containerclick: false, // click container next slide autostart: 0, // set positive number auto start , interval time restart: 0, // set positive number restart , restart time slidespeed: 100, // speed of slide animation fadespeed: 100, // speed of fade animation autoheight: false // set positive number auto height , 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; }); }
you're using slide on "#loopedslider" element:
jquery("#loopedslider").loopedslider({
but div holds container slides, instead of slides itself. have 2 options: 1) remove container or 2) switch slider element holding slides:
jquery(".slides").loopedslider({
Comments
Post a Comment