Hello,
I need to calculate the width of a div within the viewport. If i use .css(width) on my div, it just calculates the complete width.
My current code for trying to calculate:
var $Windowwidth = $(window).width();
var $lefty = $("#gallerytop");
var $GalleryTopWidth = parseInt($lefty.css('width'));
$("#footer").click(function() {
alert($Windowwidth)
alert($GalleryTopWidth)
});
What i would like to accomplish is the following:
I have one div covering the complete width of my window (100%, and beyond). I have 2 buttons for animating that div to the left and to the right per 241px. I would to be able to set a stop if my moving div has reached a certain point in my viewport (say for example, the right end of the div, by clicking on the right button, is now in the middle of my viewport/window; now i don't want it possible anymore to click on the right button).
Can anyone help?
Thank you!