css jquery hide one div, show another

前端 未结 7 1031
遥遥无期
遥遥无期 2021-01-21 22:12

I am having a challenge. I have 2 divs, one set to display:none; in the css when the page loads I have two corresponding links. When the user clicks on

7条回答
  •  旧巷少年郎
    2021-01-21 22:55

    That fiddle helped me, it is really understandable : http://jsfiddle.net/bipen/zBdFQ/1/

    $("#link1").click(function(e) {
      e.preventDefault();
      $("#div1").slideDown(slow);
      $("#div2").slideUp(slow);
    });
    
    $("#link2").click(function(e) {
      e.preventDefault();
      $("#div1").slideUp(slow);
      $("#div2").slideDown(slow);
    });
    

提交回复
热议问题