0

How do I use jQuery effects in this Code ?? The code for a button that Hide the site menu And expand the middle of the screen workspace I want this work to be done with effects and slowly..

function woow_HIDE(){
    document.getElementById('sidebar').style.display='none';
    document.getElementById('himenu').style. display='block';
    $('#mainbar').removeClass('col-lg-10 col-md-10');
    $('#mainbar').addClass('col-lg-12 col-md-12');

}
Toprex
  • 155
  • 1
  • 9
  • 2
    Possible duplicate of [Simple fade in fade out div with jquery on click](http://stackoverflow.com/questions/12584481/simple-fade-in-fade-out-div-with-jquery-on-click) – Liam Feb 22 '17 at 10:13

3 Answers3

2

Use the fadeOut() function provided by jQuery. Here's the manual

function woow_HIDE() {
    $('#sidebar').fadeOut();
    $('#himenu').fadeIn();
    $('#mainbar').removeClass('col-lg-10 col-md-10');
    $('#mainbar').addClass('col-lg-12 col-md-12');
}
motanelu
  • 3,945
  • 1
  • 14
  • 21
1
function woow_HIDE(){
   $('#sidebar').hide(1000, function(){
       $('#himenu').show(1000);
   });
   $('#mainbar').removeClass('col-lg-10 col-md-10');
   $('#mainbar').addClass('col-lg-12 col-md-12');
}

You should do like this. First hide sidebar in 1000ms then start showing himenu in 1000ms

Nitesh
  • 1,490
  • 1
  • 12
  • 20
1

You can use this fadeOut effect with time , set the time as per your requirment.

 function woow_HIDE() {
        $('#sidebar').fadeOut(1000);
        $('#himenu').fadeOut(1000);
        $('#mainbar').removeClass('col-lg-10 col-md-10');
        $('#mainbar').addClass('col-lg-12 col-md-12');
    }
Rupali Pemare
  • 540
  • 1
  • 9
  • 24