您好,登錄后才能下訂單哦!
今天小編給大家分享的是css3實現響應式滑動菜單的方法,很多人都不太了解,今天小編為了讓大家更加了解css3實現響應式滑動菜單的方法,所以給大家總結了以下內容,一起往下看吧。一定會有所收獲的哦。
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CSS3滑動動畫菜單DEMO演示</title> <link rel="stylesheet" type="text/css" href="css/default.css" /> <link rel="stylesheet" type="text/css" href="css/component.css" /> <script src="js/modernizr.custom.js"></script> </head> <body> <div> <header> <h3>CSS3響應式滑動菜單</h3> </header> <div class="main clearfix"> <nav id="menu"> <ul> <li> <a href="#"> <span> <i aria-hidden="true"></i> </span> <span>Home</span> </a> </li> <li> <a href="#"> <span> <i aria-hidden="true"></i> </span> <span>Services</span> </a> </li> <li> <a href="#"> <span> <i aria-hidden="true"></i> </span> <span>Portfolio</span> </a> </li> <li> <a href="#"> <span> <i aria-hidden="true"></i> </span> <span>Blog</span> </a> </li> <li> <a href="#"> <span> <i aria-hidden="true"></i> </span> <span>The team</span> </a> </li> <li> <a href="#"> <span> <i aria-hidden="true"></i> </span> <span>mail</span> </a> </li> </ul> </nav> <div style="text-align:center;clear:both"><br> <script src="/gg_bd_ad_720x90.js" type="text/javascript"></script><script src="/follow.js" type="text/javascript"></script></div> </div> </div><!-- /container --> <script> var changeClass = function (r,className1,className2) { var regex = new RegExp("(?:^|\\s+)" + className1 + "(?:\\s+|$)"); if( regex.test(r.className) ) { r.className = r.className.replace(regex,' '+className2+' '); } else{ r.className = r.className.replace(new RegExp("(?:^|\\s+)" + className2 + "(?:\\s+|$)"),' '+className1+' '); } return r.className; }; var menuElements = document.getElementById('menu'); menuElements.insertAdjacentHTML('afterBegin','<button type="button" id="menutoggle" aria-hidden="true"><i aria-hidden="true"> </i> Menu</button>'); document.getElementById('menutoggle').onclick = function() { changeClass(this, 'navtoogle active', 'navtoogle'); } </script> </body> </html>
以上就是css3實現響應式滑動菜單的方法的詳細內容了,看完之后是否有所收獲呢?如果想了解更多相關內容,歡迎來億速云行業資訊
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。