【发布时间】:2013-02-06 10:39:08
【问题描述】:
我想使用拖放将产品添加到购物车。 为此,我正在使用 jQuery UI Droppable 。代码是:-
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( ".category-products" ).accordion();
$( ".product-name" ).draggable({
appendTo: "body",
helper: "clone"
});
$( ".block-content ol" ).droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
accept: ":not(.ui-sortable-helper)",
drop: function( event, ui ) {
$( this ).find( ".placeholder" ).remove();
$( "<li></li>" ).text( ui.draggable.text() ).appendTo( this );
}
}).sortable({
items: "li:not(.placeholder)",
sort: function() {
// gets added unintentionally by droppable interacting with sortable
// using connectWithSortable fixes this, but doesn't allow you to customize active/hoverClass options
$( this ).removeClass( "ui-state-default" );
}
});
});
使用此代码产品名称可放入购物车,但不会添加到购物车。我尝试但无法将产品名称添加到购物车。请帮帮我。
【问题讨论】:
-
这些产品有没有产品选择?
标签: jquery jquery-ui magento magento-1.7 jquery-droppable