ajax请求同步
$.ajaxSetup({
async: false
});
JQ滑动到页面底部
var scrollHeight = $('html').prop("scrollHeight");
// $('html').scrollTop(scrollHeight,10);
$('html').animate({
scrollTop: scrollHeight
}, 800);
防止滚动时窗口抖动
//当前滚动条的高度
var p=0;
$(window).scroll(function(){
var temp_p = $(this).scrollTop();
if (temp_p-p<0) {
//向上滚动
if ($('html').is(":animated")){
$('html').stop();
p=0;
return false;
}
}
p = temp_p;
});
删除DOM树同级后面的同胞元素
$(selector).nextAll().remove();
事件绑定,支持动态创建元素的监听
$(".content").on('dblclick', '.cell', function(e) {
console.log(e);
});