

主页面index.html:
<script> <BR>$(function () { <BR>// jQuery UI Draggable <BR>$("#product li").draggable({ <br><br>// brings the item back to its place when dragging is over <BR>revert:true, <br><br>// once the dragging starts, we decrease the opactiy of other items <BR>// Appending a class as we do that with CSS <BR>drag:function () { <BR>$(this).addClass("active"); <BR>$(this).closest("#product").addClass("active"); <BR>}, <br><br>// removing the CSS classes once dragging is over. <BR>stop:function () { <BR>$(this).removeClass("active").closest("#product").removeClass("active"); <BR>} <BR>}); <BR>// jQuery Ui Droppable <BR>$(".basket").droppable({ <br><br>// The class that will be appended to the to-be-dropped-element (basket) <BR>activeClass:"active", <br><br>// The class that will be appended once we are hovering the to-be-dropped-element (basket) <BR>hoverClass:"hover", <br><br>// The acceptance of the item once it touches the to-be-dropped-element basket <BR>// For different values http://api.jqueryui.com/droppable/#option-tolerance <BR>tolerance:"touch", <BR>drop:function (event, ui) { <br><br>var basket = $(this), <BR>move = ui.draggable, <BR>itemId = basket.find("ul li[data-id='" + move.attr("data-id") + "']"); <br><br>// To increase the value by +1 if the same item is already in the basket <BR>if (itemId.html() != null) { <BR>itemId.find("input").val(parseInt(itemId.find("input").val()) + 1); <BR>} <BR>else { <BR>// Add the dragged item to the basket <BR>addBasket(basket, move); <br><br>// Updating the quantity by +1" rather than adding it to the basket <BR>move.find("input").val(parseInt(move.find("input").val()) + 1); <BR>} <BR>} <BR>}); <BR>// This function runs onc ean item is added to the basket <BR>function addBasket(basket, move) { <BR>basket.find("ul").append('<li data-id="' + move.attr("data-id") + '">' <BR>+ '<span class="name">' + move.find("h3").html() + '' <BR>+ '<input class="count" value="1" type="text">' <BR>+ '<button class="delete">✕'); <BR>} <BR>// The function that is triggered once delete button is pressed <BR>$(".basket ul li button.delete").live("click", function () { <BR>$(this).closest("li").remove(); <BR>}); <BR>}); <BR></script>
jquery-ui-1.9.0.custom.min.js
main.css:
/* reset & .clear
----------------------------*/
* {
margin: 0;
padding: 0;
}
.clear:before,
.clear:after {
content: " ";
display: table;
}
.clear:after { clear: both }
.clear { *zoom: 1 }
/* MAIN
----------------------------*/
body {
font: normal 12px/1.3 arial, sans-serif;
background-color: #eee;
}
li { list-style: none }
a { text-decoration: none }
.container {
position: relative;
width: 920px;
margin: 30px auto;
}
.container #product {
position: relative;
z-index: 2;
float: left;
width: 670px;
}
.container #sidebar {
position: relative;
z-index: 1;
float: right;
width: 224px;
}
/* PRODUCTS
----------------------------*/
#product ul {
width: 680px;
margin-left: -10px; }
#product ul li {
position: relative;
float: left;
width: 150px;
margin: 0 0 10px 10px;
padding: 5px;
background-color: #fff;
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
-webkit-transition: -webkit-transform .1s ease;
-moz-transition: -webkit-transform .1s ease;
-o-transition: -webkit-transform .1s ease;
-ms-transition: -webkit-transform .1s ease;
transition: transform .1s ease;
}
#product ul li:hover {
background-color: #fff8c1;
}
#product.active ul li {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
filter: alpha(opacity = 40);
opacity: .4;
}
#product.active ul li.active {
z-index: 2;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity = 100);
opacity: 1;
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: scale(.6);
-moz-transform: scale(.6);
-o-transform: scale(.6);
-ms-transform: scale(.6);
transform: scale(.6);
}
#product ul li a {
display: block;
color: #000
}
#product ul li a h3 {
margin-top: 5px;
}
#product ul li a h3,
#product ul li a p {
white-space: nowrap;
overflow: hidden;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
text-overflow: ellipsis;
}
#product ul li a img { width:150px;height:150px;display: block }
/* BASKET
----------------------------*/
.basket {
position: relative;
}
.basket .basket_list {
width: 220px;
background-color: #fff;
border: 2px dashed transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.basket.active .basket_list,
.basket.hover .basket_list { border-color: #ffa0a3 }
.basket.active .basket_list { background-color: #fff8c1 }
.basket.hover .basket_list { background-color: #ffa0a3 }
/* .head */
.basket .head {
overflow: hidden;
margin: 0 10px;
height: 26px;
line-height: 26px;
color: #666;
border-bottom: 1px solid #ddd;
}
.basket .head .name { float: left }
.basket .head .count { float: right }
/* .head */
.basket ul { padding-bottom: 10px }
.basket ul li {
position: relative;
clear: both;
overflow: hidden;
margin: 0 10px;
height: 26px;
line-height: 32px;
border-bottom: 1px dashed #eee;
}
.basket ul li:hover { border-bottom-color: #ccc }
.basket ul li span.name {
display: block;
float: left;
width: 165px;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
text-overflow: ellipsis;
-webkit-transition: width .2s ease;
-moz-transition: width .2s ease;
-o-transition: width .2s ease;
-ms-transition: width .2s ease;
transition: width .2s ease;
}
.basket ul li:hover span.name { width: 146px }
.basket ul li input.count {
float: right;
margin: 3px 2px 0 0;
width: 25px;
line-height: 20px;
text-align: center;
border: 0;
border-radius: 3px;
background-color: #ddd;
}
.basket ul li button.delete {
position: absolute;
right: 30px;
top: 3px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity = 0);
opacity: 0;
width: 20px;
line-height: 20px;
height: 20px;
text-align: center;
font-size: 11px;
border: 0;
color: #EE5757;
background-color: #eee;
border-radius: 3px;
cursor: pointer;
-webkit-transition: opacity .2s ease;
-moz-transition: opacity .2s ease;
-o-transition: opacity .2s ease;
-ms-transition: opacity .2s ease;
transition: opacity .2s ease;
}
.basket ul li:hover button.delete {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity = 100);
opacity: 1;
}
.basket ul li button.delete:hover {
color: #fff;
background-color: #ffa0a3;
}
.basket ul li button.delete:active {
color: #fff;
background-color: #EE5757;
}

iBatis与MyBatis:你应该选择哪个?简介:随着Java语言的快速发展,许多持久化框架也应运而生。iBatis和MyBatis是两个备受欢迎的持久化框架,它们都提供了一种简单而高效的数据访问解决方案。本文将介绍iBatis和MyBatis的特点和优势,并给出一些具体的代码示例,帮助你选择合适的框架。iBatis简介:iBatis是一个开源的持久化框架

1.处理器在选择电脑配置时,处理器是至关重要的组件之一。对于玩CS这样的游戏来说,处理器的性能直接影响游戏的流畅度和反应速度。推荐选择IntelCorei5或i7系列的处理器,因为它们具有强大的多核处理能力和高频率,可以轻松应对CS的高要求。2.显卡显卡是游戏性能的重要因素之一。对于射击游戏如CS而言,显卡的性能直接影响游戏画面的清晰度和流畅度。建议选择NVIDIAGeForceGTX系列或AMDRadeonRX系列的显卡,它们具备出色的图形处理能力和高帧率输出,能够提供更好的游戏体验3.内存电

如何选择合适的Kafka可视化工具?五款工具对比分析引言:Kafka是一种高性能、高吞吐量的分布式消息队列系统,被广泛应用于大数据领域。随着Kafka的流行,越来越多的企业和开发者需要一个可视化工具来方便地监控和管理Kafka集群。本文将介绍五款常用的Kafka可视化工具,并对比它们的特点和功能,帮助读者选择适合自己需求的工具。一、KafkaManager

在大数据场景下的MySQL储存引擎选择:MyISAM、InnoDB、Aria对比分析随着大数据时代的到来,传统的储存引擎在面对高并发、大数据量的情况下往往无法满足业务需求。MySQL作为最流行的关系型数据库管理系统之一,其储存引擎的选择显得尤为重要。在本文中,我们将对大数据场景下MySQL常用的储存引擎MyISAM、InnoDB、Aria进行对比分析,并给出

Pip镜像源大揭秘:如何选择最适合你的镜像源?简介:Pip是Python中最常用的软件包管理工具之一,能够方便地安装、升级和移除Python包。在使用Pip的过程中,选择适合自己的镜像源可以显著提高安装速度和稳定性。本文将为大家介绍常见的几种镜像源,并提供具体的代码示例,以便读者可以轻松选择最适合自己的镜像源。一、什么是镜像源?在使用Pip

JavaScript如何实现图片的左右拖动切换效果?在现代网页设计中,动态效果可以增加用户体验和视觉吸引力。而图片的左右拖动切换效果是一种常见的动态效果,它可以让用户通过拖动图片来切换不同的内容。在本文中,我们将介绍如何使用JavaScript来实现这种图片切换效果,并提供具体的代码示例。首先,我们需要准备一些HTML和CSS代码,用于创建一个包含多个图片

JavaScript如何实现弹出框的拖动的同时限制在页面可见区域内?在网页开发中,我们常常会遇到需要实现弹出框或对话框的需求。而其中一个常见的需求就是让这些弹出框能够随意拖动,并且限制在页面的可见区域内。本文将介绍如何使用JavaScript来实现这个功能,并提供相应的代码示例。首先,我们需要了解一些基本概念。在Web开发中,页面的可见区域可以用窗口的宽度

为什么学习Python是一个明智的职业选择?Python,作为一门易学易用且功能强大的编程语言,正日益成为职场人士的首选。无论你是初学者还是有一定编程经验的专业人士,学习Python都是一个明智的职业选择。本文将探讨学习Python的优势,并提供一些Python代码示例来帮助读者更好地理解。Python的易学性相比其他编程语言,Python具备非常低的学习曲


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

SublimeText3 Linux新版
SublimeText3 Linux最新版

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具