我有一个jquery操作应用于基于一个div(这是我选择div和应用行动,但我的hve 90格)在其ID如何缩写本声明: 以下是代码如何缩写jquery事件?
if ($('#justgarph > p:contains("draggable1")').length > 0) {
$(".product").animate({
"top": "0",
"left": "0"
}, 500).delay(100);
$("#draggable1").animate({
"top": "-300px",
"left": "200px"
}, 500);
setTimeout(function() {
$("#draggable1").animate({
"top": "-106px",
"left": "470px"
}, 1000);
$("#draggable1").addClass("activeproduct")
}, 800);
}
if ($('#justgarph > p:contains("draggable2")').length > 0) {
$(".product").animate({
"top": "0",
"left": "0"
}, 500).delay(100);
$("#draggable2").animate({
"top": "-300px",
"left": "100px"
}, 500);
setTimeout(function() {
$("#draggable2").animate({
"top": "-106px",
"left": "320px"
}, 1000);
$("#draggable2").addClass("activeproduct")
}, 800);
}
是'left'参数不同的“470px”和“320px” – 2013-04-21 09:27:53
如果是这样的话,你需要它作为第二个参数@ArunPJohny。除非有办法计算'left',否则我的解决方案将不再可能。 – simbabque 2013-04-21 09:29:43