Line 1: | Line 1: | ||
− | + | ||
<html> | <html> | ||
<head> | <head> | ||
− | <script | + | <script |
− | src="https:// | + | src="https://code.jquery.com/jquery-3.3.1.js" |
+ | integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" | ||
+ | crossorigin="anonymous"> | ||
</script> | </script> | ||
<style type="text/css"> | <style type="text/css"> | ||
Line 9: | Line 11: | ||
body { | body { | ||
− | + | margin: 0; | |
− | + | font-family: 'Goudy Old Style Regular',sans-serif !important; | |
− | + | font-size: 13px !important; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
+ | * {box-sizing: border-box;} | ||
+ | a:link,a:visited {color: black !important;} | ||
.menu-container { | .menu-container { | ||
Line 27: | Line 24: | ||
margin: 0 auto; | margin: 0 auto; | ||
padding-right: 30px; | padding-right: 30px; | ||
− | |||
} | } | ||
.menu > ul { | .menu > ul { | ||
− | |||
− | |||
list-style: none; | list-style: none; | ||
padding: 0; | padding: 0; | ||
position: relative; | position: relative; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
.menu > ul > li { | .menu > ul > li { | ||
float: right; | float: right; | ||
− | |||
padding: 0; | padding: 0; | ||
margin: 0; | margin: 0; | ||
Line 63: | Line 44: | ||
display: block; | display: block; | ||
} | } | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
.menu > ul > li > ul { | .menu > ul > li > ul { | ||
display: none; | display: none; | ||
width: 100%; | width: 100%; | ||
background-color: whitesmoke; | background-color: whitesmoke; | ||
− | |||
position: absolute; | position: absolute; | ||
z-index: 99; | z-index: 99; | ||
Line 79: | Line 54: | ||
margin: 0; | margin: 0; | ||
list-style: none; | list-style: none; | ||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
.menu > ul > li > ul.normal-sub { | .menu > ul > li > ul.normal-sub { | ||
Line 106: | Line 61: | ||
left: auto; | left: auto; | ||
padding: 10px 20px; | padding: 10px 20px; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
.menu > ul > li > ul.normal-sub > li a { | .menu > ul > li > ul.normal-sub > li a { | ||
− | |||
padding: 1em 0; | padding: 1em 0; | ||
} | } | ||
Line 183: | Line 128: | ||
<script> | <script> | ||
− | |||
$(document).ready(function () { | $(document).ready(function () { | ||
− | + | $('.menu > ul > li > ul:not(:has(ul))').addClass('normal-sub'); | |
− | + | //导航背景变色+下滑方法 | |
− | + | $(".menu > ul > li").hover(function () { | |
− | + | $(this).css({"background-color":"#f0f0f0"}); | |
− | + | $(this).children("ul").stop(true, false).slideToggle(300); | |
− | + | }); | |
− | + | //背景颜色还原+下拉菜单消失 | |
− | + | $(".menu > ul > li").mouseleave(function () { | |
− | + | $(this).css({"background-color":"#fff"}); | |
− | + | $(this).children("ul").hide(); | |
− | + | }); | |
}); | }); | ||
</script> | </script> |
Revision as of 08:05, 3 October 2018