Fix window Screen Js

if ($(".divContentImage").length > 0) {
var offset = $(".divContentImage").offset();
$(window).scroll(function () {
var scrollTop = $(window).scrollTop ();
//Add the fixed property if the distance from the top is less than the browser scrolling distance.

if (offset.top < scrollTop) {
$(".divContentImage").css({ top: "0px" });
}
else {//否则清除fixed的css属性
//$(".divContentImage").removeClass("fixed");
$(".divContentImage").css({ top: $(".divTitle").offset().top - 1 + "px" });
}
});
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324971691&siteId=291194637