Js Toggle Display


原文链接: Js Toggle Display

slim 版是去掉了ajax功能的瘦身版

<script type='text/javascript' src='https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js?ver=3.2.1'></script>

缓慢的将段落滑上或滑下 切换显示

$(".btn1").click(function(){
  $("p").slideToggle();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
$('#icon-for-search').click(function () {
    $('#search-wrapper').fadeToggle('slow');
});
</script>

<div id="icon-for-search">Search Icon</div>
<div id="search-wrapper">Search Wrapper</div>
<a id="loginLink" onclick="toggleTable();" href="#">Login</a>

function toggleTable() {
    var login = document.getElementById("loginTable");
    login.style.display = (lTable.style.display == "table") ? "none" : "table";
}
`