Dynamic style - manipulating CSS with JavaScript -
i have image slider in worpress theme using inline styles change display block none depending on slide is. there way separate change dynamically in js rather using inline style? changing display block when becomes current slide.
html:
<div class="single_fading_slide staged_slide" style="display: none;"> <div class="positioning load_slide_image"> <span id="355_img_1"> <img src="http://imagehere" title="" alt="" width="960" height="340" class="slide_image"> </span> </div><!-- .positioning .slide_image --> <div class="slide_overlay"></div> </div>
script:i new js appreciated. sure not of applies wanted include see it.
<script type="text/javascript"> /* <![cdata[ */ jquery(document).ready(function(){ // add class nopreload images in 'slide_content' div if( jquery('.slide_content').length>0 ) { jquery('.slide_content').find('img').addclass('nopreload'); } jquery('#fading_slides').preloader({ imgappend: '.load_slide_image', fade: false, slider: true, ondone: function(){ jquery('#slider_module .mysite_preloader_large').remove(); jquery('.slider_nav').tabs('#fading_slides > div.single_fading_slide', { effect: 'fade', fadeinspeed: 'fast', rotate: true, onbeforeclick : function(event,index) { if(this.getpanes().eq(index).children().eq(0).find('.vimeo_video').length>0) { var vimeo_video = this.getpanes().eq(index).children().eq(0).find('.vimeo_video').parent().html(); this.getpanes().eq(index).children().eq(0).find('.vimeo_video').parent().empty().html(vimeo_video); jquery('.vimeo_video').each(function(index, vimeo_video){ froogaloop.init([vimeo_video]); vimeo_video.addevent('onload', vimeoembed.vimeo_player_loaded); }); } if(this.getpanes().eq(index).children().eq(0).find('.youtube_video').length>0) { var vimeo_video = this.getpanes().eq(index).children().eq(0).find('.youtube_video').parent().html(); this.getpanes().eq(index).children().eq(0).find('.youtube_video').parent().empty().html(vimeo_video); jquery('.youtube_video').each(function(index, youtube_video){ onyoutubeplayerapiready(youtube_video.id); }); } _class = this.getpanes().eq(index).attr('class'); jquery('#slider_module_inner').removeclass(); jquery('#slider_module_inner').addclass( _class.replace('single_fading_slide ', '') ); if(this.getpanes().eq(index).children().eq(0).find('.vimeo_video').length>0 && typeof navscript != 'undefined'){ settimeout(function(){ jquery('.slider_nav_thumb .slider_nav').animate({opacity:0},300); jquery('.slider_nav_thumb .slider_nav').animate({height:'0px'},300); }, 1000 ); } }, onclick : function(event,index) {} }).slideshow({clickable:false, autoplay:true, interval:4000, autopause:true}); jquery('#fading_slides').removeclass('noscript'); jquery('.slider_nav').removeclass('noscript'); } }); }); /* ]]> */ </script>
thanks help!
you can use jquery’s .show()
, .hide()
handle this:
$('#selector').show(); $('#selector').hide();
i highly recommend spend time reading jquery api documentation, i’m sure you’d able reduce amount of code required lot.
Comments
Post a Comment