jQuery 点击展开180度菜单
jQuery 点击展开180度菜单
XML/HTML Code
- <ul id="nav">
- <li><a href="javascript:goTo('camera');"><i class="icon-camera"></i></a></li>
- <li><a href="javascript:goTo('user');"><i class="icon-user"></i></a></li>
- <li><a href="javascript:goTo('music');"><i class="icon-music"></i></a></li>
- <li><a href="javascript:goTo('commentalt');"><i class="icon-comment-alt"></i></a></li>
- <li><a href="javascript:goTo('moon');"><i class="icon-moon"></i></a></li>
- </ul>
- <section id="content">
- <article id="camera" class="active"> <i class="icon-camera"></i>
- <h1>导航菜单</h1>
- <div class="cnt"><a href="http://freejs.net/daohangcaidan.html">各种下拉菜单,导航,多级菜单,右侧展开,左侧展开</a></div>
- </article>
- <article id="user" class="off"> <i class="icon-user"></i>
- <h1>TAB标签</h1>
- <div class="cnt"> <a href="http://freejs.net/tabbiaoqian.html">tab标签,选项卡,选卡,jquery选项卡,标签页,动态加载tab</a></div>
- </article>
- <article id="music" class="off"> <i class="icon-music"></i>
- <h1>焦点图</h1>
- <div class="cnt"> <a href="http://freejs.net/jiaodiantu.html">焦点图,相册,幻灯片,轮播图</a></div>
- </article>
- <article id="moon" class="off"> <i class="icon-moon"></i>
- <h1>分页</h1>
- <div class="cnt"> <a href="http://freejs.net/fenye.html">翻页,分页,无刷新翻页,jquery翻页 本站演示中的分页数据库结构都一样的</a></div>
- </article>
- </section>
JavaScript Code
- <script type="text/javascript">
- var currentIndex = 0;
- var currentId = "camera";
- $(document).ready(function() {
- $("#nav").ferroMenu({
- position : "left-center",
- delay : 50,
- rotation : 720,
- margin : 20
- });
- });
- var colors = {
- "camera" : {
- "background" : "#D06503",
- "index" : 0
- },
- "user" : {
- "background" : "#E9931A",
- "index" : 1
- },
- "mapmarker" : {
- "background" : "#1691BE",
- "index" : 2
- },
- "music" : {
- "background" : "#166BA2",
- "index" : 3
- },
- "commentalt" : {
- "background" : "#1B3647",
- "index" : 4
- },
- "moon" : {
- "background" : "#152836",
- "index" : 5
- }
- };
- function goTo(id){
- var obj = eval("colors."+id);
- $("body").css("background",obj.background);
- $("#ferromenu-controller,#nav li a").css("color",obj.background);
- if(obj.index > currentIndex){
- $(".active").addClass("off");
- $(".active").transition({
- x : -100,
- opacity : 0,
- zIndex : 0
- },600);
- $("#"+currentId).removeClass("active");
- $("#"+id).addClass("active");
- $("#"+id).transition({
- x : 400
- },0,function(){
- $("#"+id).removeClass("off");
- $("#"+id).transition({
- x : 0,
- opacity : 1,
- zIndex : 2
- },600);
- });
- }else if(obj.index < currentIndex){
- $(".active").addClass("off");
- $(".active").transition({
- x : 100,
- opacity : 0,
- zIndex : 0
- },600);
- $("#"+currentId).removeClass("active");
- $("#"+id).addClass("active");
- $("#"+id).transition({
- x : -400
- },0,function(){
- $("#"+id).removeClass("off");
- $("#"+id).transition({
- x : 0,
- opacity : 1,
- zIndex : 2
- },600);
- });
- }
- currentIndex = obj.index;
- currentId = id;
- }
- </script>
相关推荐
周公周金桥 2020-09-06
大象从不倒下 2020-07-31
AlisaClass 2020-07-19
MaureenChen 2020-04-21
xingguanghai 2020-03-13
teresalxm 2020-02-18
木四小哥 2013-05-14
SoShellon 2013-06-01
Simagle 2013-05-31
羽化大刀Chrome 2013-05-31
waterv 2020-01-08
LutosX 2013-07-29
vanturman 2013-06-27
wutongyuq 2013-04-12
luoqu 2013-04-10
today0 2020-09-22
89520292 2020-09-18
bigname 2020-08-25