您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Jquery实现Div上下移动示例_jquery

2024/5/6 12:46:41发布30次查看
复制代码 代码如下:
$(this).ready(function() {
$(.up).each(function() {
$(this).click(function() {
var $tr = $(this).parents(li);
if ($tr.index() != 0) {
$tr.prev().before($tr);
}
});
});
var trlength = $(.down).length;
$(.down).each(function() {
$(this).click(function() {
var $tr = $(this).parents(li);
if ($tr.index() != trlength) {
$tr.next().after($tr);
}
});
});
$(a[name='up']).click(function() {
if ($(input[name='rule']:checked).size() > 1) {
alert(只能选择一项进行上下移操作!);
return;
}
$(input[name='rule']:checked).each(function() {
var $div = $('#rule_' + $(this).val());
if ($div.index() != 0) {
$div.prev().before($div);
}
});
});
$(a[name='down']).click(function() {
if ($(input[name='rule']:checked).size() > 1) {
alert(只能选择一项进行上下移操作!);
return;
}
$(input[name='rule']:checked).each(function() {
var $div = $('#rule_' + $(this).val());
if ($('#rule_' + (parseint($(this).val()) + 1)).html() != null) {
$div.next().after($div);
}
});
});
});
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product