jQuery FadeOut FadeIn -


i messing html, css , jquery, , i've run in problem. have slideshow gets images using fadein , fadeout container, when press 'next', it's resetting page , loads next image somewhere @ bottom. can tell me what's problem?

html

<div class="slideshow "> <div class="container"> <div class="slides"> <img class ="slide active-slide" src="http://gearnuke.com/wp-content/uploads/2015/06/gta-5.jpg"> <img class ="slide" src="http://cdn.wegotthiscovered.com/wp-content/uploads/gta5.jpg"> <img class ="slide" src="http://www.igta5.com/images/official-artwork-trevor-yellow-jack-inn.jpg"> <img  class="slide" src="http://cdn2.knowyourmobile.com/sites/knowyourmobilecom/files/styles/gallery_wide/public/0/67/gtav-gta5-michael-sweatshop-1280-2277432.jpg?itok=nkehentw"> </div> </div>    <div class="container "> <ul class="slider-dots"> <a href="#/" class="arrow-prev"><<</a>     <li class="dot active-dot">&bull;</li>     <li class="dot">&bull;</li>     <li class="dot">&bull;</li>     <li class="dot">&bull;</li> <a href="#/" class="arrow-next">>></a> </ul> </div> </div> 

jquery

var main=function(){ $('.arrow-next').click(function(event){     event.stoppropagation();     var currentslide=$('.active-slide');     var nextslide=$('.active-slide').next();      var currentdot=$('.active-dot');     var nextdot=currentdot.next();      if(nextslide.length==0) {nextdot=$('.dot').first(); nextslide=$('.slide').first();}      currentslide.fadeout().removeclass('active-slide');     nextslide.fadein().addclass('active-slide');      currentdot.removeclass('active-dot');     nextdot.addclass('active-dot');   });   $('.arrow-prev').click(function(event){     event.stoppropagation();     var currentslide=$('.active-slide');     var prevslide=currentslide.prev();      var currentdot=$('.active-dot');     var prevdot=currentdot.prev();  if(prevslide.length==0) {prevdot=$('.dot').last(); prevslide=$('.slide').last();}      currentslide.fadeout().removeclass('active-slide');     prevslide.fadein().addclass('active-slide');      currentdot.removeclass('active-dot');     prevdot.addclass('active-dot');  });  

};

$(document).ready(main);

you can see in fiddlehttp://jsfiddle.net/1zld58yo/

looks have fadeout fadein. after fadeout, image disappears new 1 appears. there repaint/happening after fadeout.

apply following css rules fix issue.

on div.slides, -set fixed width , height -set position relative

on images, - set position=absolute


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -