Wow... that is ... so not the jQuery way to do things ;)

 

First, go download the Dimensions plugin.  With it you can get a value
for the window's innerWidth cross-browser.  See, Dimensions extends the
.width() and .height() functions so you can pass window to the $()
selector and get a proper value.  Once that's in place you would just do
something like this...

 

$elm = $(elm); // if we are going to $() something more then once, make
a reference to it instead

$elm.animate({

            left:$(window).width() + $elm.width() + 20 // just to be on
the safe side

});

 

This is UNTESTED, and prolly doesn't fit your scenario perfectly, but
you can get an idea of what you will need to go forward.

 

HTH.

 

-ALEX

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Bryan McLemore
Sent: Tuesday, March 20, 2007 9:55 AM
To: [EMAIL PROTECTED]; jQuery Discussion.
Subject: Re: [jQuery] animating off screen

 

Here is some code from the Geometry lib I've written based on some code
out of one of my books and whatnot.


if (window.innerWidth) { //All but IE
        Geometry.getViewportWidth    = function() { return
window.innerWidth; };
        Geometry.getViewportHeight   = function() { return
window.innerHeight; };
        Geometry.getHorizontalScroll = function() { return
window.pageXOffset; };
        Geometry.getVerticalScroll    = function() { return
window.pageYOffset; };
    } else if (document.documentElement &&
document.documentElement.clientWidth) { // IE6 w/ doctype
        Geometry.getViewportWidth    = function() { return
document.documentElement.clientWidth; };
        Geometry.getViewportHeight   = function() { return
document.documentElement.clientHeight; };
        Geometry.getHorizontalScroll = function() { return
document.documentElement.scrollLeft ; };
        Geometry.getVerticalScroll   = function() { return
document.documentElement.scrollTop; };
    } else if (document.body.clientWidth) { // IE4,5,6(w/o doctype)
        Geometry.getViewportWidth    = function() { return
document.body.clientWidth; };
        Geometry.getViewportHeight   = function() { return
document.body.clientHeight; };
        Geometry.getHorizontalScroll = function() { return
document.body.scrollLeft; };
        Geometry.getVerticalScroll   = function() { return
document.body.scrollTop; };
    }


The Viewport functions will tell you how big the browser window is (
displayable area only)

On 3/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:

Hi,

Yesterday I got some great help on how to animate a DIV and move it from
offscreen left to the middle of the screen.  My question now is I want
to slide that div to off-screen right.  The complication is that I don't
know how big the user's browser is going to be.  How can I slide the div
completely off screen to the right? 

Thanks, - Dave

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/ 




-- 
--
Bryan McLemore
Kaelten 

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to