js实现菜单栏上下旋转动画效果
来源:互联网 发布:java类构造器 编辑:程序博客网 时间:2024/04/28 02:00
原始图片:
当鼠标放到”首页”上时:
<div id="menu2" class="menu">
<ul>
<li>< a href ="index.aspx"> 首 页</a ></li>
<li>< a href ="news.aspx"> 实时资讯</a ></li>
</ul>
</div>
<script src="js/jquery-1.7.2.min.js" type ="text/javascript"></ script>
<script type="text/javascript" language ="javascript">
var $jq = jQuery.noConflict();
$jq(
$jq(document).ready( function() {
/* 1st example */
/// wrap inner content of each anchor with first layer and append background layer
$jq( "#menu1 li a").wrapInner('<span class="out"></span>' ).append('<span class="bg"></span>');
// loop each anchor and add copy of text content
$jq( "#menu1 li a").each(function () {
$jq( '<span class="over">' + $jq(this).text() + '</span>').appendTo(this );
});
$jq( "#menu1 li a").hover(function () {
// this function is fired when the mouse is moved over
$jq( ".out", this ).stop().animate({ 'top': '40px' }, 250); // move down - hide
$jq( ".over", this ).stop().animate({ 'top': '0px' }, 250); // move down - show
$jq( ".bg", this ).stop().animate({ 'top': '0px' }, 120); // move down - show
}, function() {
// this function is fired when the mouse is moved off
$jq( ".out", this ).stop().animate({ 'top': '0px' }, 250); // move up - show
$jq( ".over", this ).stop().animate({ 'top': '-40px' }, 250); // move up - hide
$jq( ".bg", this ).stop().animate({ 'top': '-40px' }, 120); // move up - hide
});
/* 2nd example */
$jq( "#menu2 li a").wrapInner('<span class="out"></span>' );
$jq( "#menu2 li a").each(function () {
try {
var urlName = window.location.pathname //获取当前 URL
var param = urlName.split("/" )[1];
if ($jq(this ).attr("href") == param) {
$jq( this).attr("class" , "over");
}
$jq( '<span class="over">' + $jq(this).text() + '</span>').appendTo(this );
}
catch (e) {
}
finally {
}
});
$jq( "#menu2 li a").hover(function () {
$jq( ".out", this ).stop().animate({ 'top': '40px' }, 300); // move down - hide
$jq( ".over", this ).stop().animate({ 'top': '0px' }, 300); // move down - show
}, function() {
$jq( ".out", this ).stop().animate({ 'top': '0px' }, 300); // move up - show
$jq( ".over", this ).stop().animate({ 'top': '-40px' }, 300); // move up - hide
});
})
)
</script>
- js实现菜单栏上下旋转动画效果
- 水平菜单栏的动画效果实现
- js实现动画效果
- js实现图片旋转效果
- JS实现文本内容上下滚动效果
- js实现文字定时上下滚动效果
- 滑动菜单栏(三)SlidingMenu动画效果的实现
- 滑动菜单栏(三)SlidingMenu动画效果的实现
- 滑动菜单栏(三)SlidingMenu动画效果的实现
- Android:滑动菜单栏(三)SlidingMenu动画效果的实现
- android 实现控件的旋转动画效果
- android 实现3D动画旋转效果
- android 布局实现旋转动画效果
- android下Rotate旋转动画实现效果
- android 实现控件的旋转动画效果
- matrix 实现动画3D旋转效果
- CSS3边框旋转动画实现效果
- Android超简单实现listview上下拉伸回弹动画效果
- AJAX 跨域请求 - JSONP获取JSON数据
- Linux 防火墙策略
- 跨平台日志清理工具 Log-Cutter v1.0.3 正式发布
- NYOJ323 Drainage Ditches 最大流
- poj3020-Antenna Placement
- js实现菜单栏上下旋转动画效果
- 15个网站图片优化的原则
- MINA2.0用户手册中文版--第一章 MINA2.0入门
- linux多线程信号总结
- 别的程序员是怎么读你的简历的
- jQuery liger ui ligerGrid 打造通用的分页排序查询表格
- JSP9个内置对象
- android自动提示
- HTTP错误大全