开发者

How to jump to an anchor / div per random button (jQuery mobile)?

开发者 https://www.devze.com 2023-02-17 00:18 出处:网络
I would like to make a random page effect in my jQuery Mobile app. Therefore I want to give the user a button to click, which jumps to / displ开发者_C百科ays a random page-div on the site. thats all.v

I would like to make a random page effect in my jQuery Mobile app. Therefore I want to give the user a button to click, which jumps to / displ开发者_C百科ays a random page-div on the site. thats all.


var divs = jQuery.makeArray(document.getElementsByTagName('div'));
divs[Math.floor(Math.random()*(divs.size()+1))].doSomething();
0

精彩评论

暂无评论...
验证码 换一张
取 消