程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> html-js如何實現圖片從左下飛到右上

html-js如何實現圖片從左下飛到右上

編輯:編程解疑
js如何實現圖片從左下飛到右上

圖片說明
這個火箭被點擊可以飛行
代碼如下:

 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no, email=no, adress=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="description" content="">
<meta name="keywords" content="">
<link type="text/css" rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/shop/css/reset.css?version={$version}" />
<link type="text/css" rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/shop/css/product.css?version={$version}" />
<link type="text/css" rel="stylesheet" href="__CSS__/dialog.css?v={:SITE_VERSION}" />
<title>{$shop_config.title}</title>
</head>
<body>
<!--頂部-->
<header class="header">
    <a href="javascript:void(0);" class="header-back-btn back"></a>
    <h1>詳情</h1>
    <a href="javascript:void(0);" class="header-car-btn"  data-url="{:addons_url('Shop://Index/addCollection',array('token'=>get_token(),'id'=>$info['id']))}"></a>
    <!--a href="{:addons_url('Shop://Index/cart',array('token'=>get_token()))}" class="header-car-btn"></a-->
</header><!--header-->

<!--輪播圖-->
<section class="pic">

    <!--button class="button2" onclick="_system._guide(true)">

    </button-->
    <ul id="slider">
        <foreach name="picArr" item="row" key="k">
        <a href="javascript:void(0);"><li><img src="{$row|get_cover_url}" alt=""></li></a>
        </foreach>
    </ul>
    <section class="pic-btn" id="pagenavi">
        <foreach name="picArr" item="row" key="k">
        <a href="javascript:void(0);" <eq name="k" value="0">class="active"</eq>></a>
        </foreach>
    </section><!--pic-btn-->
    <!--a href="javascript:void(0);" class="collect-btn"  data-url="{:addons_url('Shop://Index/addCollection',array('token'=>get_token(),'id'=>$info['id']))}">收藏</a-->
    <section name="huojian" id="info">
    <if condition="$info.distribution_proportion eq 0">
    <p></p>
    <else/>
    <p class="button2" id="button2" onclick="_system._guide(true)">
        <img src="{:ADDON_PUBLIC_PATH}/shop/images/1.png">
    </p>
    </if>
    </section>
</section><!--pic-->

<section class="product">
    <ul>
        <li>{$info.name}</li>
        <li>{$info.desc}</li>
        <li>¥{$info.true_price}</li>
        <li><span>運費 {$info.mail_price}元</span><!--span>總銷<a>{$info.sellnum}</a>筆</span--></li>
    </ul>
</section><!--product-->

<!--section class="box-1">
    <a href="javascript:void(0);">分銷賺錢</a>
</section><!--box-1-->



<!--評論-->
<section class="speak-box">
    <header>
        <a href="{:addons_url('Shop://Index/evaluationList',array('token'=>get_token(),'id'=>$info['id'],'type'=>0))}">商品評論&nbsp;&nbsp;&nbsp;好評度<span>{$levelPraiseProportion}%</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>{$newEvaluation.page.count}人評論</span></a>
    </header>
    <volist name="newEvaluation.list" id="n">
    <ul>
        <li><div><img src="<if condition="$n.headimgurl eq 0">{:ADDON_PUBLIC_PATH}/shop/images/photo.jpg<else />{$n.headimgurl|get_cover_url}</if>" alt="" /></div><a>{$n.nickname|default="游客"}</a>
        <switch name="n.star">
        <case value="1"><span></span></case>
        <case value="2"><span></span><span></span></case>
        <case value="3"><span></span><span></span><span></span></case>
        <case value="4"><span></span><span></span><span></span><span></span></case>
        <case value="5"><span></span><span></span><span></span><span></span><span></span></case>
        </switch>
        </li>
        <li>{$n.content}</li>
        <li>{$n.addtime|date="Y-m-d H:i:s",###} <if condition="$n['color_id'] neq 0">顏色:{:getColorName($n['color_id'])}</if> <if condition="$n['norms_id'] neq 0 and $n['norms_details_id'] neq 0">{:getNormsName($n['norms_id'])}:{:getNormsDetailsName($n['norms_details_id'])}</if></li>
    </ul>
    </volist>
    <a href="{:addons_url('Shop://Index/evaluationList',array('token'=>get_token(),'id'=>$info['id'],'type'=>0))}" class="more-btn">查看更多評價</a>
</section><!--speak-box-->
<!--猜你喜歡-->
<section class="like-box" <if condition="empty($guessYouLike)">style="display:none;"</if>>
    <h2>猜你喜歡</h2>
    <section class="like-box-1" id="slider1">
        <foreach name="guessYouLike" item="row">
        <section class="slide">
            <foreach name="row" item="rows">
            <ul>
                <li><a href="{:addons_url('Shop://Index/productinfo',array('token'=>get_token(),'id'=>$rows['id']))}"><img src="{$rows.head_img|get_cover_url}" alt="" /></a></li>
                <li>{$rows.name|msubstr=###,0,20,"utf-8",false}</li>
                <li style="font-size:0.9rem;">¥{$rows.true_price}<!--a href="{:addons_url('Shop://Index/productinfo',array('token'=>get_token(),'id'=>$rows['id']))}">立即購買</a--></li>
            </ul>
            </foreach>

        </section><!--slide-->
        </foreach>
    </section><!--like-box-1-->
    <section class="like-box-nav" id="pagenavi1">
        <foreach name="guessYouLike" item="row" key="k">
        <a href="javascript:void(0);" <eq name="k" value="0">class="active"</eq>></a>
        </foreach>
    </section><!--like-box-nav-->
</section><!--like-box-->

<a href="{:addons_url('Shop://Index/productDetails',array('token'=>get_token(),'id'=>$info['id']))}" class="a-btn">點擊查看圖文詳情</a>


<!--
<section class="footer">
    <dl>
        <dd>15天退換貨</dd
        ><dd>全場包郵促銷</dd>
    </dl>
</section>
 -->
<section class="box-2">
    <a href="tel:4000058002">聯系客服</a>
</section><!--box-2-->
<footer class="footer-btn">
    <dl>

        <dd><a href="javascript:void(0);" data-action="car">加入購物車</a></dd
        ><dd><a href="javascript:void(0);" data-action="buy">立即購買</a></dd>
    </dl>
</footer><!--footer-btn-->


<!--分銷特效  點擊顯示分享給好友-->
<script type="text/javascript">
    var _system={
        $:function(id){return document.getElementById(id);},
   _client:function(){
      return {w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight,bw:document.documentElement.clientWidth,bh:document.documentElement.clientHeight};
   },
   _scroll:function(){
      return {x:document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft,y:document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop};
   },
   _cover:function(show){
      if(show){
     this.$("cover").style.display="block";
     this.$("cover").style.width=(this._client().bw>this._client().w?this._client().bw:this._client().w)+"px";
     this.$("cover").style.height=(this._client().bh>this._client().h?this._client().bh:this._client().h)+"px";
  }else{
     this.$("cover").style.display="none";
  }
   },
   _guide:function(click){
      this._cover(true);
      this.$("guide").style.display="block";
      this.$("guide").style.top=(_system._scroll().y+5)+"px";
      window.onresize=function(){_system._cover(true);_system.$("guide").style.top=(_system._scroll().y+5)+"px";};
  if(click){_system.$("cover").onclick=function(){
         _system._cover();
         _system.$("guide").style.display="none";
 _system.$("cover").onclick=null;
 window.onresize=null;
  };}
   },
   _zero:function(n){
      return n<0?0:n;
   }
}
</script>
<!--遮罩層-->
<div class="cover"></div>
<div id="cover"></div>
<div id="guide"><img src="{:ADDON_PUBLIC_PATH}/shop/images/guide1.png"></div>
<!--加入購物車彈層-->
<section class="car-tc">
    <ul>
        <li><img src="{$info.head_img|get_cover_url}" alt="" /></li>
        <li>{$info.name}</li>
        <li>¥{$info.true_price}</li>
    </ul>
    <dl>
        <if condition="!empty($color_arr)">
        <dd class="dd-color"><span>主要顏色</span>
        <volist name="color_arr" id="row">
        <a href="{$color_url[$row['id']]}" <eq name="row['id']" value="$info['color_id']">class="active"</eq>>{$row.name}</a>
        </volist>
        </dd>
        </if>
        <if condition="!empty($norms_details_arr)">
        <dd class="dd-style"><span>{$norms_name}</span>
        <volist name="norms_details_arr" id="row">
        <a href="{$norms_details_url[$row['id']]}" <eq name="row['id']" value="$info['norms_details_id']">class="active"</eq>>{$row.name}</a>
        </volist>
        </dd>
        </if>
        <dd class="dd-num"><span>購買數量</span><div><a href="javascript:void(0);" class="min">-</a><span class="num">1</span><a href="javascript:void(0);" class="max">+</a></div></dd>
        <input type="hidden" name="products_id" id="products_id" value="{$info['id']}" />
        <input type="hidden" name="ajaxAddCartUrl" id="ajaxAddCartUrl" value="{:addons_url('Shop://Cart/inCart',array('token'=>get_token()))}" />
        <input type="hidden" name="cartUrl" id="cartUrl" value="{:addons_url('Shop://Index/cart',array('token'=>get_token()))}" />

    </dl>

    <input type="button" value="確定" id="ok_btn" />
</section><!--car-tc-->

<div class="cover_1"></div>


<script type="text/javascript" src="{:ADDON_PUBLIC_PATH}/shop/js/jquery-1.11.1.min.js?version={$version}"></script>
<script type="text/javascript" src="__JS__/m/dialog.js?v={:SITE_VERSION}"></script>
<script type="text/javascript" src="{:ADDON_PUBLIC_PATH}/shop/js/jquery.cycle.all.js?version={$version}"></script>
<script type="text/javascript" src="{:ADDON_PUBLIC_PATH}/shop/js/touchslider.dev.js?version={$version}"></script>
<script type="text/javascript" src="{:ADDON_PUBLIC_PATH}/shop/js/product.js?version={$version}"></script>

<include file="./Addons/Shop/View/default/Index/publicShare.html" />
</body>
</html>

最佳回答:


 <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
<style>
    #rocket{position:absolute;background:#ccc;left:0;bottom:0;width:100px;height:100px}
</style>
<div id="rocket"></div>
<script>
    $(function () {
        var rocket = $('#rocket')
            , rw = rocket.width()
            , rh = rocket.height()
            , ch = Math.max(document.body.clientHeight, document.documentElement.clientHeight)
            , cw = Math.max(document.body.clientWidth, document.documentElement.clientWidth);

        rocket.animate({ left: cw - rw, top: ch - ch }, 2000, function () { rocket.hide()});
    })
</script>
showbo
u013056785
showbo
u013056785
showbo
u013056785
u013056785
showbo
u013056785
u013056785
showbo
showbo
u013056785
showbo
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved