jquery - How to simulate a "Page Down" button press every 2 seconds? -
I want to simulate a scroll down with a "page down" button in a page. I have a function called every 2 seconds, but it does not have to connect to the keyboard buttons (how to press a keyboard button?).
var interval = null; JQuery (function () {interval = set interval (callfuck, 2000);}); Function callFunc () {jQuery ('link1, .link2, .link 3'). Triggers ('Clicks'); }
Thanks!
**** EDITING ****
It starts working, which means that when it is inserted in the console it calls the callFunc function at every 500ms, But I can not fix the part inside the function to simulate the button press. (The keycode for the "Page Down" button is 34)
var interval = null; $ (Function () {interval = set interval (callfunk, 500);}); Function callFunc () {var event = $ .vent ('keypress'); Event.which = 34; Event.keyCode = 34; $ (This) .trigger (event); }
Anyone?
Finally what I wanted to do was to gain a "page down" to simulate a keyboard Instead, which was not working for some unknown reasons for me (I think I got the keycode wrong), I simulate a sculpture:
var interval = zero; $ (Function () {interval = set interval (callfunk, 500);}); Function callFunc () {var scroll = $ (window) .scrollTop (); Var scroll = scroll + 500; $ ("Html, Body"). Chetan ({scrollTop: scrollto}); }
This is a way to automatically scroll to any page and trigger the page's infinite scroller. My example is to retrieve a large list of Facebook pages:
Comments
Post a Comment