首页 > 代码库 > jQuery示例
jQuery示例
1.菜单栏示例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> #menu{ border: 1px solid red; width: 200px; height: 600px; } .menu1{ background-color: #4876FF; height: 40px; } .one{ padding-left: 50px; } .one1{ padding-left: 50px; } .hide{ display: none; } .content span{ display: block; padding-left: 100px; } .see{ display: none; } </style> </head> <body> <div id="menu"> <div> <div class="menu1">菜单1</div> <div class="content see"> <span>1</span> <span>2</span> <span>3</span> <span>4</span> </div> </div> <div> <div class="menu1">菜单2</div> <div class="content see"> <span>1</span> <span>2</span> <span>3</span> <span>4</span> </div> </div> <div> <div class="menu1">菜单3</div> <div class="content see"> <span>1</span> <span>2</span> <span>3</span> <span>4</span> </div> </div> </div> <script src="high/jquery-1.12.4%20(1).js"></script> <script> $(".menu1").click(function () { $(this).next().removeClass("see"); $(this).parent().siblings().find(".content").addClass("see") }) </script> </body> </html>
jQuery示例
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。