• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
繁星
不要浪费时间
博客园    首页    新随笔    联系   管理    订阅  订阅

Jquery应用:图片导航

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title> new document </title>
    <meta name="generator" content="editplus" />
    <meta name="author" content="handy" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <script type="text/javascript" language="javascript" src="../JS/jquery.js"></script>
  <style>
  *{margin:0;padding:0}

  #nav{
  width:740px;
  height:240px;
  position:relative;
  top:20px;
  left:20px;
  background:#000;
  overflow:hidden}
 
  #mask{position:absolute;background:#000;
  width:100%;height:50px;
  bottom:0px;border-top:1px solid #999;
  text-align:right;
  filter:alpha(opacity=60);
  -moz-opacity:0.6;}
 
  #frontText{position:absolute;width:100%;
  top:20px;left:20px;font-family:Verdana;
  font-size:30px;font-weight:900;color:#fff}

  #frontTextBack{position:absolute;width:100%;
  top:22px;left:22px; //2个像素的偏移量 阴影效果..
  font-family:Verdana;
  font-size:30px;
  font-weight:900;
  color:#000}

  #frontTextSub{position:absolute;width:100%;
  top:60px;left:25px;
  font-family:Verdana;
  font-size:13px;color:#fff}
 
  #nav ul{position:absolute;left:3px;bottom:0px;
  text-align:left;z-index:999}

  #nav ul li{display:block;width:245px;
  float:left;position:relative;color:#999;
  font-weight:900;font-size:11px;
  font-family:Arial;height:50px}

  #nav li div{margin-left:70px;
  padding-left:10px;
  margin-top:5px}

  #nav li img{border:1px solid #fff;
  float:left;margin-right:4px;
  position:absolute;left:10px;
  top:5px;cursor:pointer;
  filter:alpha(opacity=60);-moz-opacity:0.6;
  }
  </style>
 </head>

 <body bgcolor="#666666">

  <div id="nav">
  <ul>
        <li><img src="01.jpg" pic="1" text="He is Handy|some text here"><div>一片麦穗</div></li>
        <li><img src="02.jpg" pic="2" text="She is LE|a prety girl"><div>一个海岛</div></li>
        <li><img src="03.jpg" pic="3" text="They are Happy|a perfect family"><div>一树绿叶</div></li>
  </ul>
  <div id="frontTextBack"></div>
  <div id="frontText"></div>
  <div id="frontTextSub"></div>
  <div id="mask">Power By Handy</div>
  <div id="back"><img src="1.jpg"></div>
  </div>

 <script type="text/javascript">
 <!–
    $("li img").click(function(){
       
        //如果已经处于active状态,return
        if (this.className.indexOf("active")!=-1) return;
       
        //正文标题文字渐隐
        $("#frontText").fadeOut();
        $("#frontTextBack").fadeOut();
        $("#frontTextSub").fadeOut();

        //active状态的图片恢复原样
        $("li img.active").animate({top:5,width:52,left:10},300)
        .removeClass("active")
        .fadeTo(200,0.6)
        .parent().css({"color":"#999"});  //
       
        //获取数据
        var i = $(this).attr("pic");
        var t = $(this).attr("text").split("|");
       
        //当前
        $(this).animate({top:-5,width:70,left:1},200)
        .addClass("active")
        .fadeTo(200,1)
        .parent().css({"color":"white"});

        $("#back").fadeTo(500,0.1,function(){
                   $(this).children("img").attr("src",i+".jpg");      //更改图片
                   $(this).fadeTo(500,1,function(){
                                                 $("#frontText").html(t[0]).fadeIn(200);    //更改正文文标题字
                                                 $("#frontTextBack").html(t[0]).fadeIn(200);    //阴影文字
                                                 $("#frontTextSub").html(t[1]).fadeIn(200)   //副标题
                                                 });
                                        })
        })

    //初始第一张图片
    $("li img").eq(0).click();
 //–>
 </script>
 </body>
</html>

posted @ 2008-08-19 23:33  ※繁星※  阅读(479)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3