html - fadeIn/fadeOut and addClass/removeClass from divs JQuery -


i using below jquery code add , remove class has display:none property , add class has display:block 3 different divs positioned relatively. have side navigation has 3 links that, when clicked, want displays different divs on page, 1 fading out , other fading in.

$(document).ready(function () {     $('#what-we-do, #location').hide();     $('#who-we-are').show(); });  $(function () {     $("#show-main-who").mousedown(function () {         $('#what-we-do, #location').fadeout('fast', function () {             $(this).addclass('hide-info');             $(this).removeclass('show-info');         });     });     $('#show-main-who').mouseup(function () {         $('#who-we-are').fadein('fast', function () {             $(this).removeclass('hide-info');             $(this).addclass('show-info');         });     }); }); $(function () {     $("#show-main-what").mousedown(function () {         $('#who-we-are, #location').fadeout('fast', function () {             $(this).addclass('hide-info');             $(this).removeclass('show-info');         });     });     $('#show-main-what').mouseup(function () {         $('#what-we-do').fadein('fast', function () {             $(this).removeclass('hide-info');             $(this).addclass('show-info');         });     }); }); $(function () {     $("#show-main-location").mousedown(function () {         $('#what-we-do, #who-we-are').fadeout('fast', function () {             $(this).addclass('hide-info');             $(this).removeclass('show-info');         });     });     $('#show-main-location').mouseup(function () {         $('#location').fadein('fast', function () {             $(this).removeclass('hide-info');             $(this).addclass('show-info');         });     }); }); 

when see website @ http://jacobbuller.com/testsites/peacock/ , use side navigation can see div fade out other div fading in shows below instant, moves place. makes choppy , unprofessional, idea how fix without having make divs positioned absolutely?

this have far after making changes suggested, it's still shows div below original before sliding place once div fades out...

$(document).ready(function() {     $('#what-we-do, #location').hide();         $('#who-we-are').show();              $("#show-main-who").click(function() {             $('#what-we-do, #location').fadeout('fast',function(){             $(this).removeclass('show-info');             $(this).addclass('hide-info');              });              $('#who-we-are').fadein('fast',function(){                 $(this).addclass('show-info');                 $(this).removeclass('hide-info');             });         });               $("#show-main-what").click(function() {             $('#who-we-are, #location').fadeout('fast',function() {             $(this).addclass('hide-info');             $(this).removeclass('show-info');             });               $('#what-we-do').fadein('fast',function(){                 $(this).removeclass('hide-info');                 $(this).addclass('show-info');             });         });          $("#show-main-location").click(function() {             $('#what-we-do, #who-we-are').fadeout('fast',function(){             $(this).addclass('hide-info');             $(this).removeclass('show-info');             });               $('#location').fadein('fast',function(){                 $(this).removeclass('hide-info');                 $(this).addclass('show-info');         });     }); }); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -