Reputation: 25
Hi Can Somebody Help me Out Here I want this popup window to appear after the user scrolls in the page heres my code
<script type="text/javascript">
var adblock = true;
</script>
<script type="text/javascript" src="adframe.js"></script>
<script type="text/javascript">
if(adblock)
{
alert("We Noticed You are using Ad blocker :( We Work Really Hard and Spend Huge Time to test
and verify these files for you. Please Support us By Disabling Ad blocker for this Domain. We
dont show any popups or Poor Ads. Because we hate them too. If you cannot disable Ad blocker
for our site. We can understand, Dont Worry! Your Download will start always regardless of Ad
Blocker. Consider sending us small donation. Because we want to keep this site free as long
as possible.");
document.getElementById("wrapper").style.display="none";
}
</script>
so can somebody help this script to modify and make this to appear like when user scrolls the page it shall appear
Upvotes: 0
Views: 722
Reputation: 1334
This will get the job done!
let ScrollThreshold = window.innerHeight/10; //Divide the full height of window by 10 to get your 10%
document.addEventListener('scroll', function(e)
{
if(window.scrollY > ScrollThreshold)
{
//Add your pop-up code right here!
console.log(`The window scroll is at ${window.scrollY}, which is beyond the threshold of ${ScrollThreshold}`);
}
});
Upvotes: 3