Slide div due to another div via jquery

We have div content (#content), and on the right side of the div-tab (#tab) - when the user presses #tab, he should slide to the right and show various parameters.

I am not sure how to create this through jQuery. I thought (CSS project that I put together in my head):

 #content {
 z-index:10;
margin:0 auto
}

#tab {
z-index: 5;
float: left;
width: 150px
}

and javascript that moves #tab to the right by 140 pixels (10px tab]

This way, usually #tab will be mainly (except for the 10px graphic icon) behind #content, and jquery just changes position to move it to the right.

Is it possible? Is there a better approach?

+3
source share
2 answers

, , z-index #tab , #content. #content #tab.

jQuery...

$("#tab").click(function(){
      $(this).animate({"left": "+=50px"}, "slow");
    });
+2

Source: https://habr.com/ru/post/1708342/


All Articles