jquery.lavalamp 下划线随鼠标左右滑动的导航菜单效果

本文介绍了如何使用jQuery.lavalamp插件创建一个下划线随着鼠标在导航菜单上移动的效果。包括引入文件、HTML结构、JavaScript配置、参数设置以及CSS样式。详细步骤和官方链接供参考。

jquery.lavalamp 下划线随鼠标左右滑动的导航菜单效果

引入文件

<!-- Include jQuery -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
 
<!-- Optional: Include the easing plugin -->
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
 
<!-- Include the lava lamp plugin -->
<script type="text/javascript" src="js/jquery.lavalamp.min.js"></script>

 

HTML

<ul id="navlist">
    <li class="active"><a href="/">Home</a></li>
    <li><a href="/about.html">About</a></li>
    <li><a href="/services.html">Services</a></li>
    <li><a href="/programs.html">Programs</a></li>
    <li><a href="/contact.html">Contact</a></li>
</ul>

 

javascript

$('#navlist').lavalamp({
    easing: 'easeOutBack'
});

 

参数

OPTIONDEFAULTPARAMETERSDESCRIPTIONNOTES
duration1000IntegerDuration of transition animation. 
easing"swing"stringEasing of transition animation.Include and read the easing plugin to use something other than swing.
marginsfalsetrue/falseLava Lamp object's width and height covers the margins. 
setOnClickfalsetrue/falseThe Lava Lamp object moves to the a new element when you click. 
activeObj".active"selectorDefault active element when page is loaded. 
autoUpdatefalsetrue/falseLava Lamp updates itself every interval. 
updateTime100IntegerTime between updates if using autoUpdate. 
enableHovertruetrue/falseEnable mouseenter and mouseleave events.If your app is for touch devices, and touch is triggering hover.
delayOn0IntegerPlace a delay when you enter hover state before lavalamp object animates. 
delayOff0IntegerPlace a delay when you leave hover state before lavalamp object animates. 
enableFocusfalsetrue/falseAnimate on keyboard focus. 
deepFocusfalsetrue/falseAnimate on decendant focus.

 

css

/*背景颜色*/
.lavalamp-object {
    background-color:#ccc;
}

 

/*线条*/
.lavalamp-object {
 width: 9px;
 height: 32px;
 border-bottom-width: 1px;
 border-bottom-style: solid;
 border-bottom-color: #fff;
 color: #999999;
}

 

官网:http://lavalamp.magicmediamuse.com/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值