Skip to content Skip to sidebar Skip to footer

Slide In A Div From Bottom Of The Page?

I am trying to the achieve an affect like the one on this page: Slide Up/Down DIV from bottom center of the page using jquery but I need it to work on page load with 5-6 seconds de

Solution 1:

JQUERY:

use it with the window.onload = function ...

setTimeout(function() {
    var top = $('#yourID').position().top;
    document.getElementById('youridhere').scrollIntoView();

}, 5000); // your timeout in ms

JAVASCRIPT

old question, but if anyone finds this through google (as I did) and who does not want to use anchors or jquery there's a builtin javascript function to 'jump' to an element.

document.getElementById('youridhere').scrollIntoView();

and what's even better, according to the great compatibility-tables on quirksmode, this is supported by all major browsers!

OR You can use an anchor to "focus" the div. I.e:

<div id="myDiv"></div>

and then use the following javascript:

// the next line is required to work around a bug in WebKit (Chrome / Safari)
location.href = "#";
location.href = "#myDiv";

And else look at this fiddle :) there is a javascript only scroll animation

http://jsfiddle.net/ySeWk/

Post a Comment for "Slide In A Div From Bottom Of The Page?"