分享一款基于jQuery弹性展开收缩菜单插件gooey.js。这是一款基于gooey.js插件实现的弹性菜单特效代码。效果图如下:

在线预览   源码下载

实现的代码。

html代码:

  <header class="plugin-demo-header"><h1>Gooey Menu</h1>
<nav id="gooey-upper">
<input type="checkbox" class="menu-open" name="menu-open1" id="menu-open1"/>
<label class="open-button" for="menu-open1">
<span class="burger burger-1"></span>
<span class="burger burger-2"></span>
<span class="burger burger-3"></span>
</label><a href="#features" class="gooey-menu-item"> <i title="Features" class="fa fa-cog fa-2x"></i> </a>
<a href="#h-spaced-menu" class="gooey-menu-item"> <i title="Horizontal Menu" class="fa fa-arrows-h fa-2x"></i> </a>
<a href="#menu-v-example" class="gooey-menu-item"> <i title="Vertical Menu" class="fa fa-arrows-v fa-2x"></i> </a>
<a href="#docs" class="gooey-menu-item"> <i title="Docs" class="fa fa-book fa-2x"></i> </a>
<a href="#event-api" class="gooey-menu-item"> <i title="Event API" class="fa fa-code fa-2x"></i> </a>
<a href="#round" class="gooey-menu-item"> <i title="Round Menu" class="fa fa-circle fa-2x"></i> </a></nav>
</header><div class="container"><div id="page1"><h1 class="section-label">Menu Styles</h1><div class="section-cont" id="h-spaced-menu"><i class="desc">Horizontal menu with glued items</i><div class="row"><div class="col-xs-12 col-sm-6 col-md-5"><nav id="gooey-h"><input type="checkbox" class="menu-open" name="menu-open2" id="menu-open2"/>
<label class="open-button" for="menu-open2">
<span class="burger burger-1"></span>
<span class="burger burger-2"></span>
<span class="burger burger-3"></span>
</label><a href="#" class="gooey-menu-item"> <i class="fa fa-train"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-bicycle"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-rocket"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-automobile"></i> </a></nav></div><div class="col-xs-12 col-md-7 code-example"><pre class="prettyprint linenums">$(function() {$("#gooey-h").gooeymenu({style: "horizontal",contentColor: "white",horizontal: {menuItemPosition: "glue"}});});
</pre></div></div></div><div class="section-cont" id="round"><div class="row"><div class="col-md-5 col-xs-12 col-sm-6 round-example"><i class="desc">Round menu with glued items (the glued effect may be achieved by adjusting"size" and circle radius property values closer (e.g, 80 and 85)) </i><nav id="gooey-round">
<input type="checkbox" class="menu-open" name="menu-open3" id="menu-open3"/>
<label class="open-button" for="menu-open3">
<span class="burger burger-1"></span>
<span class="burger burger-2"></span>
<span class="burger burger-3"></span>
</label><a href="#" class="gooey-menu-item"> <i class="fa fa-train"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-bicycle"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-rocket"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-automobile"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-plane"></i> </a>
</nav></div><div class="col-md-7 col-xs-12 code-example"><pre class="prettyprint linenums">$(function() {$("#gooey-round").gooeymenu({bgColor: "#ffc0cb",contentColor: "white",style: "circle",circle: {radius: 85},size: 80});});
</pre></div></div></div><div class="section-cont" id="menu-v-example"><div class="row"><div class="col-md-5 col-xs-12 vertical-example"><i class="desc">Vertical menu ("up" and "down" direction may be achieved by changingcorresponding properties). </i><nav id="gooey-v">
<input type="checkbox" class="menu-open" name="menu-open4" id="menu-open4"/>
<label class="open-button" for="menu-open4">
<span class="burger burger-1"></span>
<span class="burger burger-2"></span>
<span class="burger burger-3"></span>
</label><a href="#" class="gooey-menu-item"> <i class="fa fa-train"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-bicycle"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-rocket"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-automobile"></i> </a>
</nav></div><div class="col-md-7 col-xs-12 code-example"><pre class="prettyprint linenums">$(function() {$("#gooey-v").gooeymenu({style: "vertical",vertical: {menuItemPosition: "spaced",direction: "up"}});});</pre></div></div></div><h1 class="section-label">Event API</h1><div class="section-cont" id="event-api"><div class="row"><div class="col-md-5 col-xs-12 event-api-ex"><i class="desc">Use event API to hook into animation "open" and "close" events. In thisexample, we change menu item colors when menu "open" and "close" events are triggered.</i><nav id="gooey-API">
<input type="checkbox" class="menu-open" name="menu-open5" id="menu-open5"/>
<label class="open-button" for="menu-open5">
<span class="burger burger-1"></span>
<span class="burger burger-2"></span>
<span class="burger burger-3"></span>
</label><a href="#" class="gooey-menu-item"> <i class="fa fa-train"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-bicycle"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-rocket"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-automobile"></i> </a>
<a href="#" class="gooey-menu-item"> <i class="fa fa-plane"></i> </a>
</nav></div><div class="col-md-7 col-xs-12 code-example"><pre class="prettyprint linenums">$(function() {$("#gooey-round").gooeymenu({    circle: {radius: 85},open: function() {$(this).find(".gooey-menu-item").css("background-color", "steelblue");$(this).find(".open-button").css("background-color", "steelblue");},close: function(gooey) {$(this).find(".gooey-menu-item").css("background-color", "#00ffff");$(this).find(".open-button").css("background-color", "#00ffff");}});});</pre></div></div></div></div><div id="docs"><div class="plugin-details"><h1 class="section-label">Plugin details</h1><p><span class="bold">Version</span>: 1.0<br><span class="bold">Created by</span>: Kirill Goltsman<br><span class="bold">Email</span>: goltsmank@gmail.com</p></div><h1 class="section-label">1. Getting started</h1><p>Put "gooey" plugin folder into your project. Include below code snippets into <code>head</code> section of your html file. You may include Font Awesome plugin ifyou want ready-made icons in your menu.</p><pre class="prettyprint linenums lang-html">
&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">&lt;/script>
&lt;script type="text/javascript" src="gooey/src/gooey.min.js">&lt;/script>
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
&lt;link rel="stylesheet" href="gooey/src/gooey.min.css"&gt;
</pre><h1 class="section-label">2. Add Markup</h1><p>Add markup to your html file. You can use any number of menu links and any labelsor text for your menu links. The markup structure proposed below is desirable toavoid any bugs. You can use any valid class or id name for your <code>nav</code>element. This will be automatically handled by the plugin.<br><span class="bold" style="color: red;">Note:</span> If you use several menus onone page, don't forget to create unique ids and names for your hidden checkbox elementsthat have class ".menu-open".</p><pre class="prettyprint linenums html-lang">
&lt;nav id="gooey">
&lt;input type="checkbox" class="menu-open" name="menu-open" id="menu-open"/>
&lt;label class="open-button" for="menu-open">&lt;span class="burger burger-1"> &lt;/span>&lt;span class="burger burger-2"> &lt;/span>&lt;span class="burger burger-3"> &lt;/span>
&lt;/label>&lt;a href="#" class="gooey-menu-item">  &lt;i class="fa fa-cab"> &lt;/i>  &lt;/a>
&lt;a href="#" class="gooey-menu-item">  &lt;i class="fa fa-automobile"> &lt;/i>  &lt;/a>
&lt;a href="#" class="gooey-menu-item">  &lt;i class="fa fa-truck"> &lt;/i>  &lt;/a>
&lt;a href="#" class="gooey-menu-item">  &lt;i class="fa fa-rocket"> &lt;/i>  &lt;/a>
&lt;/nav> </pre><h1 class="section-label">3. Hook up your menu</h1><p>To indicate your settings, put the following code within a <code>script</code> tagin your <code>head</code> section, html <code>body</code> element or in a separateJavascript file. Here is an example of how to set a horizontal Gooey Menu with pinkmenu items. Please, remember that a selector's id or class on which <code>gooeyMenu</code>function is called should be identical to <code>nav</code> element id or class inyour html markup (in this example, <code>nav</code> id is <code>gooey</code>)</p><pre class="prettyprint linenums">$(function() {$("#gooey").gooeymenu({style: "horizontal",bgColor: "pink"});});
</pre><h1 class="section-label">4. Specify your settings</h1><p>You have a list of options to tailor a gooey menu to your needs</p><pre class=" prettyprint linenums">style: "horizontal",    // {String} Sets gooey menu style. Accepted values: "horizontal","vertical","circle"size:70,                // {Integer} Sets a menu item's size in pixelsmargin:"medium",        //  {String} Sets the margin between menu items. Acts only if "spaced" option of "horizontal" or "vertical" style is selected. Accepted values: "small","medium" and "large"bgColor: "steelblue", // {String} Sets background-color of a menu-item elementcontentColor:"white",    // {String} Sets font color of a menu item's content;transitionStep:100,     // {Integer}  Sets a speed rate at which each menu item unfolds in millisecondsbounce:false,           // {Boolean}  Turns "bounce" effect off if {false} and on if {true}bounceLength:"medium",  // {String}   Sets the bounce length, if bounce effect is enabled. Accepted values: "small", "medium" and "large"hover:"white",    // {String} Sets menu items' color on hover// Style-specific settingscircle: {radius:80            // {Integer} Sets a radius of menu circle when a menu is opened (in pixels)},horizontal: {menuItemPosition:"glue" // {String} "Spaced" option sets the spacing of menu items by a specified margin. "Glue" option makes items stacked.},vertical:  {menuItemPosition:"spaced" // {String} "Spaced" option sets the spacing of menu items by a specified margin. "Glue" option makes items stacked.direction:"up"            // {String} Values: "up" or "down". A direction in which vertical menu unfolds},//Callback APIopen:function(){},    // {function} Fires when a gooey menu is opened.
<code>$(this)</code> context for the function is the element on which <code>gooeymenu</code> was calledclose:function() {}   // {function} Fires when a gooey menu is closed. <code>$(this)</code> context for the function is the element on which <code>gooeymenu</code> was called};};
</pre><h1 class="section-label">Styling your menu</h1><p>Style menu's margins and indentation. You may set menu items indentation by changingleft/top/right/bottom or margin properties of menu items and menu open button. Sincemenu's size will depend on a number of items and menu style selected, you have afull freedom to set position of your menu according to your needs. Note, that .navimenucontainer is relatively positioned by default and menu items are absolutely positioned.</p><pre class="prettyprint linenums">.navimenu .gooey-menu-item, .navimenu .open-button {border-radius: 100%;left: 50px; /* Style left indent */top:100px;  /*  Style top indent */position: absolute;}</pre><p>Change a burger icon's background</p><pre class='prettyprint linenums'>.navimenu .burger {background: white;}
</pre><h1 class="section-label">Credits</h1><p>Scripts and plugins used in the demo and these docs</p><ol class='bold'><li>jQuery</li><li>FontAwesome </li><li>Google Code Prettify </li></ol></div></div><header class="plugin-demo-header">

via:http://***/Article/36782

jQuery弹性展开收缩菜单插件gooey.js相关推荐

  1. 基于jQuery弹性展开收缩菜单插件gooey.js

    首先 引入css <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel ...

  2. 炫酷的jQuery手风琴图片和菜单插件及源码

    手风琴效果的应用非常广泛,我们常见的有手风琴图片切换和手风琴菜单,同时它也是焦点图的一种展现形式之一.今天我们就来分享一些基于jQuery的手风琴图片和菜单插件,并提供源代码下载,一起来看看吧. 1. ...

  3. html下拉菜单插件,简单的jQuery大型下拉菜单插件

    booNavigation是一款简单的jQuery大型下拉菜单插件.通过该插件可以制作3列大型下拉菜单,并带有平滑过渡效果,以及鼠标滑过菜单项时的动画效果. 使用方法 在页面中引入jquery和boo ...

  4. 帮助用户更好的体验网站:jQuery的页面功能向导插件Pageguide.js

    为什么80%的码农都做不了架构师?>>>    日期:2012-6-15  来源:GBin1.com 在线演示  本地下载 大家可能都有过这样的开发经验,用户无法真正的了解如何使用一 ...

  5. 多级手风琴下拉菜单插件metisMenu.js

    下载地址 metisMenu.js是一个纯JavaScript导航菜单插件,可以帮助你创建响应式,动画,手风琴/下拉菜单导航.主要特色光滑的折叠/展开动画.启用AJAX.兼容的桌面和移动.事件处理程序 ...

  6. Minecraft TrMenu 菜单插件的JS动作高级用法

    目录 导读 关于 TrMenu JavaScript 脚本动作 高级用法 类的引入与实例化 待更新- 导读 本文主要是对 TrMenu 插件高级脚本动作(JavaScript Action)的用法详解 ...

  7. 多级联动下拉菜单插件:jquery.cxselect.js

    话说这个插件,我也用了挺久了,但一直对其具体的作用不是很懂,只知道可以利用 ajax来请求数据,实现类似于多级联动的效果.后来百度了下,在此做个总结吧. 下面是以一名php程序员的角度来分析的...可 ...

  8. JQuery之ContextMenu(右键菜单)

    JQuery之ContextMenu(右键菜单) 插件下载地址: http://www.trendskitchens.co.nz/jquery/contextmenu/jquery.contextme ...

  9. 导航菜单 gooey-menu jQuery液态融合(gooey)样式导航菜单插件(精)

    gooey-menu是一款基于SVG过滤器的液态融合(gooey)样式导航菜单jQuery插件.通过该插件你可以非常轻松的制作出各种gooey样式的环形菜单特效. 查看原文 查看在线演示Demo和更多 ...

最新文章

  1. php 商场收银收费系统,使用的策略模式
  2. prototype原型模式
  3. Palo Doris不会用?(基础指南)
  4. 怎样开始学习ERP?
  5. python批量删除文件名_python批量删除文件名中的未知字符
  6. 京西古道,王平到圈门的穿越
  7. Reg Organizer v8.75 注册表及系统清理优化工具
  8. java如何把汉字转换成机内码_如何用java随机生成一个汉字?
  9. b样条和三次样条_B样条(贝塞尔曲线和b样条曲线)
  10. 中国农业全要素生产率(1949-2020年)
  11. Java通过cad图生成3d模型,将CAD图纸转换为SolidWorks三维模型
  12. 计算机里没有硬盘 右下角有图标,电脑右下角显示硬盘图标怎么去掉<br?电脑 – 手机爱问...
  13. 2007.12.25 2个意外惊喜
  14. 面试算法:利用堆栈计算逆向波兰表达式
  15. 【NKOJ-4234】三角分形
  16. SQL 校验身份证格式
  17. Ubuntu卸载历程,包含重启进入grub解决方案
  18. Unity Shader - GrabPass 实现武器热扭曲拖尾效果
  19. 浏览器实现pdf下载、ms http下载、IE不兼容
  20. 折腾安装archlinx记录

热门文章

  1. TOJ 2921 古韵之鹊桥相会 / 深搜
  2. 软件开发以后发展怎么样?
  3. 稳健性检验的几种方法
  4. 2023华为产品测评官-开发者之声 + 华为云ModelArts试用体验心得
  5. 中鑫优配热点:电力板块+5G概念+智能医疗+生物疫苗
  6. 什么是大数据?怎么理解大数据?有哪些作用和应用场景?
  7. trick or treat!
  8. IDEA的打断点以及facets和artifacts的讲解以及Datebase 使用技巧
  9. 关于foreground与background的区别
  10. 解决 Heroku CLI 登录问题