1
inview.js 스크립트를 조작 할 수있는 방법을 알고 싶습니다. 해고가 뷰포트의 첫 번째 픽셀에없고 순간적으로 요소가 밖으로 나올 때가 마지막입니다. 예를 들어 50pixels 이전 또는 이후. inview.js의 스크립트 내이 시도가 작동 최고 top = $el.offset().top + 50,
을 상쇄 값을 추가하는 것이 었습니다inview.js가 실행 중일 때 조작합니다.
(function ($) {
function getViewportHeight() {
var height = window.innerHeight; // Safari, Opera
var mode = document.compatMode;
if ((mode || !$.support.boxModel)) { // IE, Gecko
height = (mode == 'CSS1Compat') ?
document.documentElement.clientHeight : // Standards
document.body.clientHeight; // Quirks
}
return height;
}
$(window).scroll(function() {
var vpH = getViewportHeight(),
scrolltop = (document.documentElement.scrollTop ?
document.documentElement.scrollTop :
document.body.scrollTop),
elems = [];
// naughty, but this is how it knows which elements to check for
$.each($.cache, function() {
if (this.events && this.events.inview) {
elems.push(this.handle.elem);
}
});
if (elems.length) {
$(elems).each(function() {
var $el = $(this),
top = $el.offset().top,
height = $el.height(),
inview = $el.data('inview') || false;
if (scrolltop > (top + height) || scrolltop + vpH < top) {
if (inview) {
$el.data('inview', false);
$el.trigger('inview', [ false ]);
}
} else if (scrolltop < (top + height)) {
if (!inview) {
$el.data('inview', true);
$el.trigger('inview', [ true ]);
}
}
});
}
});
// kick the event to pick up any elements already in view.
// note however, this only works if the plugin is included after the elements are bound to 'inview'
$(function() {
$(window).scroll();
});
})(jQuery);
모든 크레딧 이동
here입니다! 하지만 어떻게하면 아래쪽의 가치를 바꿀 수 있습니까? 감사 테드