惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LINUX DO - 最新话题
罗磊的独立博客
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Hacker News: Front Page
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Hacker News
The Hacker News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
大猫的无限游戏
大猫的无限游戏
PCI Perspectives
PCI Perspectives
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
NISL@THU
NISL@THU
小众软件
小众软件
S
Security Affairs
腾讯CDC
人人都是产品经理
人人都是产品经理
C
Check Point Blog
The GitHub Blog
The GitHub Blog
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Project Zero
Project Zero
G
Google Developers Blog
博客园 - 三生石上(FineUI控件)
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园_首页
Jina AI
Jina AI
The Cloudflare Blog
C
Cisco Blogs
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
L
Lohrmann on Cybersecurity
Y
Y Combinator Blog
W
WeLiveSecurity
V
Visual Studio Blog
Scott Helme
Scott Helme
N
News | PayPal Newsroom
I
Intezer
C
CXSECURITY Database RSS Feed - CXSecurity.com
Attack and Defense Labs
Attack and Defense Labs
Spread Privacy
Spread Privacy
Webroot Blog
Webroot Blog
T
Threatpost
雷峰网
雷峰网
MongoDB | Blog
MongoDB | Blog
N
News and Events Feed by Topic

博客园 - sojay

凡客诚品的跨域获取cookies方法 SQL2005 中 &quot;SQL_Latin1_General_CP1_CI_AS&quot; 和 &quot;Chinese_PRC_CI_AS&quot; 之间的排序规则冲突 asp.net下载文件的常用方法大全 - sojay - 博客园 IE8下ewebeditor编辑器不能使用的解决办法 - sojay - 博客园 Asp.net SEO优化,针对<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value=""> - sojay 在使用UpdatePanel时JS对话框出错的解决办法。 获取Repeater中Footer/HeaderTemplate 中的控件 repeater嵌套 - sojay - 博客园 用css进行导航定位 导航栏标签定位 - sojay - 博客园 (转)才几百K的eWebEditor v4.6 For asp.net编辑器 各种 Lightbox 效果的实现 XP中IIS“http500”错误的终极解决方法 (原)ASP.NET中的单引号和双引号 - sojay - 博客园 Application, Session, Cookie, Viewstate, Cache对象用法和区别(转) 转载 .NET牛人应该知道些什么?备忘 学习 应用 我的毕业设计 修改MD5加密 提高网站安全 对google个性主页的拖拽效果的js的完整注释
jquery 飞入购物车效果
sojay · 2012-12-18 · via 博客园 - sojay

自己参照着网上写呢,在最近的一个项目中使用,防淘宝网添加购物车飞入效果。自动根据购物车div的位置移动过去。

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chainable Transition Effects</title>
<script type="text/javascript" src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){ 
    $(".Listbox img").hover(
        function () {
            var thisTop = $(this).offset().top; //菜品所在位置的高度
            var thisLeft = $(this).offset().left; //菜品所在位置的宽度
            var css = {
                display: 'block',
                top: thisTop-4,
                left: thisLeft+102
                };
            $(".W_layer").css(css);
        },
        function () {
           $(".W_layer").css("display","none");
        }
    );
    $(".run").click(function(){ 
        var menID =  $(this).attr("id");
        var thisTop = $("#img_" + menID).offset().top; //菜品所在位置的高度
        var thisLeft = $("#img_" + menID).offset().left; //菜品所在位置的宽度
         animatenTop(thisTop,thisLeft);
        return false; 
    }); 
}); 
function animatenTop(thisTop,thisLeft) {
    var CopyDiv = '<div id="box" style="top:' + thisTop + 'px;left:' + thisLeft + 'px"></div>';
    var topLength =  $(".shopMenu li").offset().top; //取得到MINI购物车的宽度
    var leftLength = $(".shopMenu li").offset().left; //取得到MINI购物车的宽度 
    $("body").append(CopyDiv);
    $("body").children("#box").animate({width: "30px",height: "30px", "top": topLength, "left": leftLength, "opacity": .1  }, 900, function(){$(this).remove()});
}
</script>
<style type="text/css">
body {
    margin: 20px auto;
    padding: 0;
    width: 1000px;
    font: 80%/120% Arial, Helvetica, sans-serif;
}
li {
    list-style:none;
}
a {
    font-weight: bold;
    color: #000000;
}
.Listbox {
    float:left;
    width:600px;
    border:1px #F00 solid;
}
.Listbox li {
    float:left;
    margin:10px;
}
.shopMenu {
    float:left;
    border:1px #F00 solid;
    width:200px;
}
#box {
    background: #6699FF;
    height: 100px;
    width: 100px;
    position: absolute;
}
/*hover框*/
.W_layer {
    position:absolute;
    -moz-border-radius:4px;
    -webkit-border-radius:4px;
    z-index:9999;
    color:#666;
}
.W_layer .bg {
    padding:4px;
    -moz-border-radius:4px;
    -webkit-border-radius:4px;
    background:url("http://img.t.sinajs.cn/t4/style/images/common/layer_bg.png?id=1341302813656") repeat;
    float:left;
}
.W_layer dl
{
    width:420px;
    background-color:#fff;
    float:left;
    margin:0;
    padding:0;
    border:1px #ccc solid;
}
.W_layer dl dt
{
    float:left;
    width:220px;
}
.W_layer dl dt img
{
    margin:10px;
}
.W_layer dl dd
{
    float:left;
    width:200px;
    margin:0;
    padding:0;
}
.W_layer dl dd h3
{
    font-size:14px;
    font-weight:bold;
}
.W_layer .arrow{
    position:absolute;
    overflow:hidden;
    display:block;
    background:url("http://img.t.sinajs.cn/t4/style/images/common/layer_arrow.png?id=1341302813656") no-repeat;
}
.W_layer .arrow_r, .W_layer .arrow_l {
    width:11px;
    height:16px;
    top:20px;
    right:-6px;
    background-position:-11px -24px;
}
.W_layer .arrow_l {
    right:auto;
    left:-6px;
    background-position:0 -24px;
}
</style>
</head>
<body>
<div class="Listbox">
  <li>
    <p><img src="http://yongshan8.com/Imgs/a.gif" height="100" width="100" id="img_1" /></p>
    <a href="#" class="run" id="1">点我</a></li>
  <li>
    <p><img src="http://yongshan8.com/Imgs/a.gif" height="100" width="100" id="img_2" /></p>
    <a href="#" class="run" id="2">点我</a></li>
  <li>
    <p><img src="http://yongshan8.com/Imgs/a.gif" height="100" width="100" id="img_3" /></p>
    <a href="#" class="run" id="3">点我</a></li>
</div>
<div class="shopMenu" style="margin-top:200px;">
  <ul>
    <li id="Null">空饭盒</li>
  </ul>
</div>
<div style="z-index: 9999;left:200px;top:100px; display:none;" class="W_layer">
  <div class="bg">
    <dl>
      <dt>
      <img src="http://yongshan8.com/Imgs/a.gif" width="200" height="200" />
      </dt>
      <dd>
          <h3>红烧肉盖饭</h3>
          <p>红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭红烧肉盖饭</p>
      </dd>
      </dl>
      <div class="arrow arrow_l"></div>
    </div>
  </div>
</div>
</body>
</html>