Hide element when clicked outside jquery
$(document).mouseup(function(e) {
var container = $("YOUR CONTAINER SELECTOR");
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.hide();
}
});
Detect Scroll Position (Up/Down) using jQuery
var lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
// downscroll code
} else {
// upscroll code
}
lastScrollTop = st;
});
Stick div at top when srolling
http://jsfiddle.net/0mLzseby/473/
Tổng hợp một số đoạn code jQuery hữu ích
Reviewed by kentrung
on
May 10, 2019
Rating:
No comments: