jquery小盒子菜单特效

 

jquery小盒子菜单特效,点击可以查看大图
需      要: 0.0 金币
折      扣: 100 (% 折)
 
相关搜索: jquery 小盒子 菜单 特效 
下载次数: 13
支持一下(1)
100.00%
踩一下(0)
0.00%
  • 下载等级:
  • 编  号: 20120601163326
  • 浏览器兼容Firefox9.0及以前,Firefox10.0,Chrome17.0及以前,Chrome18.0
  • 更新日期: 2012-06-01
  • 大  小: 1.20MB
  • 浏览次量: 2246
  • 开发者链接: 官网  演示
  • 相  关: 违规举报
  • 收  藏:( 0 人收藏) 加入收藏
  • 此内容校验人员: sinacomcn
分享到:   
17sina  
 中士 上传于/2012-06-01 16:36:59
零星会员   
   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>jquery小盒子菜单特效 by 25175</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
<style>
* { margin:0; padding:0; }
body { background:#E4FFCF url(wood.jpg) no-repeat top center; font-family:Futura, "Century Gothic", AppleGothic, sans-serif; overflow:hidden; }
h1 { color:#fff; margin:40px 0px 20px 40px; text-shadow:1px 1px 1px #555; font-weight:normal; }
a.back { position:absolute; bottom:5px; right:5px; }
.reference { position:absolute; bottom:5px; left:5px; }
.reference p a, a.back { text-transform:uppercase; text-shadow:1px 1px 1px #fff; color:#666; text-decoration:none; font-size:16px; font-weight:bold; }
.reference p a:hover, a.back:hover { color:#000; }
</style>
</head>
<body>
<div class="title">
  <h1>Little Boxes Menu with jQuery</h1>
</div>
<div id="content">
  <div class="reference">
    <p><a href="http://www.25175.com">Photos from williamcho's photostream on 25175</a></p>
  </div>
  <a class="back" href="http://www.25175.com">Back to 25175</a>
  <div id="littleBoxes" class="littleBoxes">
    <div class="boxlink bg1" style="top:0px;left:0px;"> <a href="">About</a>
      <div class="boxcontent">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna
          aliqua. Ut enim ad minim veniam, quis nostrud exercitation
          ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
      </div>
    </div>
    <div class="bg5" style="background-position:-90px 0;top:0px;left:95px;"></div>
    <div class="bg5" style="background-position:-180px 0;top:0px;left:190px;"></div>
    <div class="bg5" style="background-position:-270px 0;top:0px;left:285px;"></div>
    <div class="bg5" style="background-position:0 -90px;top:95px;left:0px;"></div>
    <div class="boxlink bg2" style="top:95px;left:95px;"> <a href="">Menu</a>
      <div class="boxcontent">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna
          aliqua. Ut enim ad minim veniam, quis nostrud exercitation
          ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
      </div>
    </div>
    <div class="bg5" style="background-position:-180px -90px;top:95px;left:190px;"></div>
    <div class="bg5" style="background-position:-270px -90px;top:95px;left:285px;"></div>
    <div class="bg5" style="background-position:0 -180px;top:190px;left:0px;"></div>
    <div class="bg5" style="background-position:-90px -180px;top:190px;left:95px;"></div>
    <div class="boxlink bg3" style="top:190px;left:190px;"> <a href="">Chef</a>
      <div class="boxcontent">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna
          aliqua. Ut enim ad minim veniam, quis nostrud exercitation
          ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
      </div>
    </div>
    <div class="bg5" style="background-position:-270px -180px;top:190px;left:285px;"></div>
    <div class="bg5" style="background-position:0 -270px;top:285px;left:0px;"></div>
    <div class="bg5" style="background-position:-90px -270px;top:285px;left:95px;"></div>
    <div class="bg5" style="background-position:-180px -270px;top:285px;left:190px;"></div>
    <div class="boxlink bg4" style="top:285px;left:285px;"> <a href="">Contact</a>
      <div class="boxcontent">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna
          aliqua. Ut enim ad minim veniam, quis nostrud exercitation
          ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
      </div>
    </div>
  </div>
</div>


<div style="width:550px;margin:20px auto;">
<p><strong><a href="http://www.25175.com" target="_blank">25175</a></strong> </p>
<p></p>
</div>

<!-- The JavaScript -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.easing.1.3.js"></script>
<script type="text/javascript">
            $(function() {
                /* object to save the initial positions of each box */
                var divinfo = {"initial": []};
                /* index of the selected / clicked box */
                var current = -1;

                /* we save the index,top and left of each one of the boxes */
                $('#littleBoxes > div').each(function(){
                    var $this = $(this);
                    var initial = {
                                'index' : $this.index(),
                                'top'     : $this.css('top'),
                                'left'     : $this.css('left')
                    };
                    divinfo.initial.push(initial);
                });

                /* clcik event for the anchors inside of the boxes */
                $('#littleBoxes a').bind('click',function(e){
                        var $this         = $(this);
                        var $currentBox    = $this.parent();
                        /* set a z-index lower than all the other boxes,
                        to see the other boxes animation on the top*/
                        $currentBox.css('z-index','1');

                        /* if we are clicking on a expanded box : */
                        if(current == $currentBox.index()){
                            /* put it back (decrease width,height, and set the top and left like it was before).
                            the previous positions are saved in the divinfo obj*/
                            $currentBox.stop().animate({
                                    'top'         : divinfo.initial[$currentBox.index()].top,
                                    'left'        : divinfo.initial[$currentBox.index()].left,
                                    'width'     : '90px',
                                    'height'    : '90px'
                            },800,'easeOutBack').find('.boxcontent').fadeOut();


                            $('#littleBoxes > div').not($currentBox).each(function(){
                                var $ele         = $(this);
                                var elemTop     = divinfo.initial[$ele.index()].top;
                                var elemLeft     = divinfo.initial[$ele.index()].left;
                                $ele.stop().show().animate({
                                    'top'         : elemTop,
                                    'left'        : elemLeft,
                                    'opacity'    : 1
                                },800);
                            });
                            current = -1;
                        }
                        /* if we are clicking on a small box : */
                        else{
                            /* randomly animate all the other boxes.
                            Math.floor(Math.random()*601) - 150 gives a random number between -150 and 450.
                            This range is considering the initial lefts/tops of the elements. It's not the exact right
                            range, since we would have to calculate the range based on each one of the boxes. Anyway, it
                            fits our needs...
                            */
                            $('#littleBoxes > div').not($currentBox).each(function(){
                                var $ele = $(this);
                                $ele.stop().animate({
                                    'top' : (Math.floor(Math.random()*601) - 150) +'px',
                                    'left': (Math.floor(Math.random()*601) - 150) +'px',
                                    'opacity':0
                                },800,function(){
                                    $(this).hide();
                                });
                            });

                            /* expand the clicked one. Also, fadeIn the content (boxcontent)
                            if you want it to fill the space of the littleBoxes container,
                            then these are the right values */
                            var newwidth     = 379;
                            var newheight     = 379;
                            $currentBox.stop().animate({
                                'top'     : '0px',
                                'left'    : '0px',
                                'width' : newwidth +'px',
                                'height': newheight+'px'
                            },800,'easeOutBack',function(){
                                current = $currentBox.index();
                                $(this).find('.boxcontent').fadeIn();
                            });


                        }
                        e.preventDefault();
                });
            });
        </script>
</body>
</html>

 购买记录
mrfool
新兵
opq5120
新兵
miladhamzelo
新兵
a5227230
新兵
EraLeap
新兵
cping1210
新兵
chrisyun
新兵
刘涛_90
新兵
mr_question_zhang
新兵
wcx14311
新兵
taiyu6005
新兵
chengge
新兵
会员评论:  

一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播不法有害信息!

二、互相尊重,对自己的言论和行为负责。

  验证码:
 
反馈请帮助我们提高!意见反馈