每次调用函数时增加保证金顶部
Increment Margin Top each time function is called
每次调用我的函数时,我都试图增加我的 margin-top。这不应该工作吗?
$('.btn-default').css("marginTop", parseInt($(this).css("marginTop") +=28));
使用 jQuery 的 $.fn.css
方法(从 jQuery 1.6 开始)您只需要传递相对值部分。它将为您确定基值:
$(".btn-default").css("marginTop", "+=28");
每次调用我的函数时,我都试图增加我的 margin-top。这不应该工作吗?
$('.btn-default').css("marginTop", parseInt($(this).css("marginTop") +=28));
使用 jQuery 的 $.fn.css
方法(从 jQuery 1.6 开始)您只需要传递相对值部分。它将为您确定基值:
$(".btn-default").css("marginTop", "+=28");