我有一个页面,当你滚动它时,对象(容器...)变得可见。 同时我还有项目。所以当你点击其中一个时,我的页面会向上滚动。我想禁用之前提到的那个功能(显示出来,而不是禁用滚动!)。
$(document).ready(function(){
var offsetActivity = (1);
var wScroll = ($(window).scrollTop());
var wHeight = ($(window).innerHeight());
var thirdHeight = (wHeight/1.3);
$('.secondic > .row > a > .one-half > p').click(function(offsetActivity){
var offsetActivity = (0);
var projBack = $(this).parent().css('background-image');
var parent = $(this).parent().attr('id');
var textAbout = $('#'+ parent +' > p.about-photo').text();
$('header').css('background-image', ''+ projBack +'');
$('header > .headerCont > h5').replaceWith('<h5>'+ textAbout +'</h5>');
setTimeout(function(){
$('.container').removeClass('offset-done');
$('.container').children().removeClass('offset-done');
}, 2000);
});
if(offsetActivity = (1)){
$(window).scroll(
function(){
var wScroll = ($(window).scrollTop());
var wHeight = ($(window).innerHeight());
var thirdHeight = (wHeight/1.3);
console.log(wHeight, wScroll, thirdHeight);
if(wScroll > (($('.container').offset().top)-thirdHeight)){
$('.container').addClass('offset-done');
}
if(wScroll > (($('.window').offset().top)-thirdHeight)){
$('.window').addClass('offset-done');
}
});
});
如何在点击我的 P 键时禁用该功能?并且我希望在关闭项目后能够再次启用它。