Reputation: 3277
I'm trying to make the page scroll down on page ready, I can already detect the data from the $_GET variable. However, it does not scroll down to do the the selected element.
$(document).ready(function(){
var ok = "<?php echo (isset($_GET['gets'])) ? $_GET['gets'] : $_GET['gets'] ?>";
var a = "#number-"+ok;
$('body').scrollTop(a);
});
Upvotes: 0
Views: 161
Reputation: 82241
Try this:
$('html, body').animate({
scrollTop: $("#number-"+ok).offset().top
}, 2000);
Upvotes: 2