Someone can solve my jquery -


i know less amount of jquery can me.. have written code failed in last thing,

  • image(from lest side) 2 , 3 should fade out , first image slide left while clicking on button1. , same button tow , three.
  • on clicking button1 if first sections active (left image , bottom text) should fade , re-appear sliding effect.

$(".c2").css("display", "none");  $(".c3").css("display", "none");  $(".image03").css("display", "none");  $(".image02").css("display", "none");  $(document).ready(function() {      $('.img01').click(function() {          $(".image01").show("slide", {              direction: "left"          });          $(".c1").show("slide", {              direction: "right"          });          $(".c2").css("display", "none");          $(".c3").css("display", "none");          $(".image03").effect('fade', 200).css("display", "none");          $(".image02").effect('fade', 200).css("display", "none");      });        $('.img02').click(function() {          $(".image02").show("slide", {              direction: "left"          }, 500);          $(".c2").show("slide", {              direction: "right"          }, 500);          $(".c1").effect('fade', 200).css("display", "none");          $(".c3").effect('fade', 200).css("display", "none");          $(".image03").effect('fade', 200).css("display", "none");          $(".image01").effect('fade', 200).css("display", "none");      });      $('.img03').click(function() {          $(".image03").show("slide", {              direction: "left"          }, 500);          $(".c3").show("slide", {              direction: "right"          }, 500);          $(".c1").effect('fade', 200).css("display", "none");          $(".c2").effect('fade', 200).css("display", "none");          $(".image02").effect('fade', 200).css("display", "none");          $(".image01").effect('fade', 200).css("display", "none");      });  });
.slide {    padding-top: 30px;  }  .img01, .img02, .img03 {    cursor: pointer;  }
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>  <div class="container">        <div class="row">         	<div class="col-xs-6">          	<div class="img-show">                  <div class="image01 slide"><img src="http://classes.yale.edu/fractals/panorama/nature/rivers/riverss.gif" class="img-responsive" /></div>                  <div class="image02 slide"><img src="http://shalomisraeltours.com/wp-content/uploads/2011/03/amud-stream-nature-reserve-200x100.jpg" class="img-responsive" /></div>                  <div class="image03 slide"><img src="http://naturepreserves.ohiodnr.gov/portals/dnap/websitescreative_postit/27763/ec1ef173-8b35-414c-a8c3-ff06d141590e.jpg" class="img-responsive" /></div>              </div>          </div>          <div class="col-xs-6 img-ico">          	<div class="img01 col-xs-4"><img src="http://www.codeproject.com/kb/buttons/netimagebutton/examplebutton.png" width="43" height="31" />design</div>              <div class="img02 col-xs-4"><img src="http://getsafesea.com/images/submit-button.png" width="43" height="31" />design</div>              <div class="img03 col-xs-4"><img src="http://softwaresupportserviceshost.com/caaconnect/wp-content/uploads/sites/2/2013/06/login-button.png" width="43" height="31" />design</div>              <div class="clearfix"></div>                                  <div class="content">              	<div class="contentshow c1">this photoshop's version of lorem ipsum. proin gravida nibh vel velit auctor aliquet. aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat nec sagittis sem nibh id elit. duis sed odio sit amet nibh vulputate cursus sit amet mauris. morbi accumsan ipsum velit.</div>                  <div class="contentshow c2">this photoshop's version of lorem ipsum. proin gravida nibh vel velit auctor aliquet. aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat nec sagittis sem nibh id elit. duis sed odio sit amet nibh vulputate cursus sit amet mauris. morbi accumsan ipsum velit.</div>                  <div class="contentshow c3">this photoshop's version of lorem ipsum. proin gravida nibh vel velit auctor aliquet. aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat nec sagittis sem nibh id elit. duis sed odio sit amet nibh vulputate cursus sit amet mauris. morbi accumsan ipsum velit.</div>              </div>          </div>      </div><!--row-->      </div><!--container-->

i think jquery fadeout() method give need. have implemented possible solution, hope have understood requirements. have taken opportunity refactor code:

$(document).ready(function() {    reload('.image01', '.c1'); // first load      $('.img01').click(function() {      reload('.image01', '.c1');    });      $('.img02').click(function() {      reload('.image02', '.c2');    });    $('.img03').click(function() {      reload('.image03', '.c3');    });  });    function reload(imageclass, contentclass) {    $(".c1").fadeout();    $(".c2").fadeout();    $(".c3").fadeout();    $(".image01").fadeout("slow", function() {      $(".image02").fadeout("slow", function() {        $(".image03").fadeout("slow", function() {          $(imageclass).show("slide", {            direction: "left"          }, 500);          $(contentclass).show("slide", {            direction: "right"          }, 500);        });      });    });  }

please see demo here


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -