javascript - can this be done without jquery? -


how can show alert when have scrolled right 300px?

$('.container').scroll(function () {     if ($(this).scroll() === 300) { //         alert("you've scrolled 300 pixels.");     } }); 

can getting callback without using jquery?

you can bind onscroll method:

window.onscroll = function() {     if (window.pageyoffset == 300) {         alert("you've scrolled 300 pixels.");     } }; 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

c++ - How to test/verify that zero-initialization takes place -

node.js - Webpack/TypeScript Raising Errors When node_modules is Excluded -