先来看看效果:[url=http://demo.jb51.net/js/jquery_flash/demo.htm]http://demo.jb51.net/js/jquery_flash/demo.htm[/url]
因为下面的menu和上面的logo的实现原理一样,为了简化起见,我们这里只拿logo部分的代码来说明一下原理:
HTML代码:
[url=]
CSS代码:
a#logotype{ background: url(logotype.jpg) no-repeat top left; display: block; position: relative; height: 70px; width: 119px; } a#logotype span{display:none} a#logotype .hover { background: url(logotype.jpg) no-repeat bottom left; display: block; position: absolute; top: 0; left: 0; height: 70px; width: 119px; } a#logotype{
background: url(logotype.jpg) no-repeat top left;
display: block;
position: relative;
height: 70px;
width: 119px;
}
a#logotype span{display:none}
a#logotype .hover {
background: url(logotype.jpg) no-repeat bottom left;
display: block;
position: absolute;
top: 0;
left: 0;
height: 70px;
width: 119px;
}
这里有一个.hover的class,从html中并没有发现,不要着急,这个在后面的js中会用到。
JS代码:
[url=http://www.1sucai.cn/jiaoben/26432.html]基于jQuery实现的仿flash菜单效果[/url]