im using a paid plan and i would like to use the randomized effect on my page. I’ve been using this as a reference but the issue im facing is that i don’t want to have a random button for the whole website. i only want it for 4-5 pages. is there a way to code this somehow? i know the bare basics of coding but im not an expert but i would love to make this work!
Hey,
the easiest way would be something like this:
setTimeout(function() {
let links = [];
links[0] = "http://www.google.com/";
links[1] = "http://www.bing.com/";
links[2] = "http://www.yahoo.com/";
links[3] = "http://www.apple.com/";
function openLink() {
var i = ~~(Math.random() * links.length);
window.location.href = links[i];
return false;
}
$('[data-id=insert-your-data-id]').on('click', function() {
openLink();
});
}, 1000);
make sure to paste the data-id of your randomizebutton.
hey, thanks so much! <3 so if the links that i wanted to randomize is within my website (within the readymag pages) then how would i add the links for that?
just paste in the urls of your rm project