其他代码

基于SVG超酷圆形导航菜单特效

也想出现在这里?联系我们
创客主机


这是一款基于SVG的超酷圆形导航菜单特效。该导航菜单通过SVG进行布局,然后通过js和CSS代码来在鼠标hover菜单时,制作菜单项的动画效果。

使用方法

在页面中引入style.css和index.js文件。

  1. <link rel="stylesheet" href="css/style.css">
  2. <script  src="js/index.js"></script>

HTML结构

导航菜单的HTML结构如下:

  1. <div class="main">
  2.   <div class="navigation-circle">
  3.     <div class="navigation-circle__inner">
  4.       <svg class="navigation-circle-svg navigation-circle-svg--opaque" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewbox="0 0 320 320" style="enable-background:new 0 0 320 320;">
  5.         <circle cx="160" cy="160" r="158" fill="none" stroke-width="1" stroke="#c644fc" stroke-linecap="round" stroke-miterlimit="10" style="stroke-dashoffset:0;stroke-dasharray:none;"></circle>
  6.       </svg>
  7.       <svg class="navigation-circle-svg navigation-circle-svg--mask" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewbox="0 0 320 320" style="enable-background:new 0 0 320 320;">
  8.         <circle id="mask-circle" cx="160" cy="160" r="158" fill="none" stroke-width="2" stroke="#c644fc" stroke-linecap="round" stroke-miterlimit="10" style="stroke-dasharray:1005.3088px;"></circle>
  9.       </svg>
  10.       <ul class="navigation-circle__list">
  11.         <li class="navigation-circle-list-item"><a class="navigation-circle-list-item__point" onclick="onClick(1)" onmouseenter="calculateOffset(1)" onMouseLeave="onMouseLeave()">
  12.             <div class="navigation-circle-list-item__meta">
  13.               <h3 class="navigation-circle-list-item__title">Item #1
  14.               </h3>
  15.               <h4 class="navigation-circle-list-item__subtitle">It just goes round and round</h4>
  16.             </div></a></li>
  17.         <li class="navigation-circle-list-item"><a class="navigation-circle-list-item__point" onclick="onClick(2)" onmouseenter="calculateOffset(2)" onMouseLeave="onMouseLeave()">
  18.             <div class="navigation-circle-list-item__meta">
  19.               <h3 class="navigation-circle-list-item__title">Item #2
  20.               </h3>
  21.               <h4 class="navigation-circle-list-item__subtitle">It just goes round and round</h4>
  22.             </div></a></li>
  23.         <li class="navigation-circle-list-item"><a class="navigation-circle-list-item__point" onclick="onClick(3)" onmouseenter="calculateOffset(3)" onMouseLeave="onMouseLeave()">
  24.             <div class="navigation-circle-list-item__meta">
  25.               <h3 class="navigation-circle-list-item__title">Item #3
  26.               </h3>
  27.               <h4 class="navigation-circle-list-item__subtitle">It just goes round and round</h4>
  28.             </div></a></li>
  29.         <li class="navigation-circle-list-item"><a class="navigation-circle-list-item__point" onclick="onClick(4)" onmouseenter="calculateOffset(4)" onMouseLeave="onMouseLeave()">
  30.             <div class="navigation-circle-list-item__meta">
  31.               <h3 class="navigation-circle-list-item__title">Item #4
  32.               </h3>
  33.               <h4 class="navigation-circle-list-item__subtitle">It just goes round and round</h4>
  34.             </div></a></li>
  35.         <li class="navigation-circle-list-item"><a class="navigation-circle-list-item__point" onclick="onClick(5)" onmouseenter="calculateOffset(5)" onMouseLeave="onMouseLeave()">
  36.             <div class="navigation-circle-list-item__meta">
  37.               <h3 class="navigation-circle-list-item__title">Item #5
  38.               </h3>
  39.               <h4 class="navigation-circle-list-item__subtitle">It just goes round and round</h4>
  40.             </div></a></li>
  41.         <li class="navigation-circle-list-item"><a class="navigation-circle-list-item__point" onclick="onClick(6)" onmouseenter="calculateOffset(6)" onMouseLeave="onMouseLeave()">
  42.             <div class="navigation-circle-list-item__meta">
  43.               <h3 class="navigation-circle-list-item__title">Item #6
  44.               </h3>
  45.               <h4 class="navigation-circle-list-item__subtitle">It just goes round and round</h4>
  46.             </div></a></li>
  47.         <li class="navigation-circle-list-item"><a class="navigation-circle-list-item__point" onclick="onClick(7)" onmouseenter="calculateOffset(7)" onMouseLeave="onMouseLeave()">
  48.             <div class="navigation-circle-list-item__meta">
  49.               <h3 class="navigation-circle-list-item__title">Item #7
  50.               </h3>
  51.               <h4 class="navigation-circle-list-item__subtitle">It just goes round and round</h4>
  52.             </div></a></li>
  53.       </ul>
  54.     </div>
  55.   </div>
  56. </div>
(0)

本文由 创客云 作者:创客云 发表,转载请注明来源!

热评文章

发表评论

嘿,欢迎咨询!