Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have been working on a plugin of wordpress, in which i save the last reading position, the width and height of the browser at the time of closing the browser, I save the width and height with jquery height=$(window).height(); width=$(window).width(); and save the values in database so that when the page is loaded next time, the values are retrieved from database and the screen is scrolled to last reading position and the window get resized to the saved values.

The problem that i m getting is that the window resizes to a very less value and window gets smaller, the jquery methods height=$(window).height(); width=$(window).width(); are saving lesser values, can anybody help me out in this?

share|improve this question
    
It appears this question is not about anything WordPress-specific, but more about jQuery in general. I think you would have more success if you re-ask this question on Stack Overflow. –  Jan Fabry Sep 7 '10 at 10:29
    
@Jan Fabry I'm half-hearted with you, but jQuery is part of the wordpress stack. Don't we answer CSS questions for Themes any longer? MsManiya wrote about creating a wordpress plugin, so I think any hints should be welcome :) –  hakre Sep 7 '10 at 22:04
    
thanks Jan Fabry...very true :) –  MsManiya Sep 8 '10 at 7:57
add comment

1 Answer

Next to .height() and .width() there is .outerHeight() and .innerHeight() (same for width as well). You might be looking for these methods to gather the browsers size, not only the size of the windows viewport.

Keep in mind that this not always works 100% across all browsers, so you always might run into problems if you need it pixel-perfect.

share|improve this answer
    
thanks a lot for your response, let me try :) –  MsManiya Sep 8 '10 at 7:57
    
but it says in the link that the methods .outerHeight and .outerWidth is not applicable to window and document objects; for these, use .height() instead :( –  MsManiya Sep 8 '10 at 8:04
    
When I remember back the last time I wanted to achieve something similar - that was with Netscape 2.0.1 and we hadn't any javascript libraries that time, it was not possible to do so. I always needed to add some guessed amount of pixels for each windows side and menus, titles etc. to come close. So I think if the other functions in jQuery do not fit, then it's probably not possible at all. Sorry. –  hakre Sep 8 '10 at 12:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.