Drew_Tronvig Posted May 11, 2014 Share Posted May 11, 2014 I have only the haziest understanding of AJAX, but at this point I just want to check the height of the browser window and get that into a PHP variable before I generate the actual page. Is there an example of that sort of thing posted somewhere? I'm working in Joomla, so jQuery is loaded. Thanks, Drew Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/ Share on other sites More sharing options...
Rifts Posted May 14, 2014 Share Posted May 14, 2014 if your using jquery $(window).height(); // returns height of browser viewport $(document).height(); // returns height of HTML document $(window).width(); // returns width of browser viewport $(document).width(); // returns width of HTML document Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/#findComment-1479408 Share on other sites More sharing options...
Drew_Tronvig Posted May 14, 2014 Author Share Posted May 14, 2014 i admit to knowing practically nothing about AJAX, but these look to me like they would be functions that could be used in javascript -- in the browser, of course. How would I then get these values back to PHP variables on the server? Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/#findComment-1479410 Share on other sites More sharing options...
Jacques1 Posted May 14, 2014 Share Posted May 14, 2014 If you know nothing about Ajax, how about learning it? jQuery has an excellent documentation. And of course there's Google with tons of additional explanations. I don't see the point of repeating the same things that have already been written down thousands of times and are just waiting for you to read them. Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/#findComment-1479449 Share on other sites More sharing options...
Drew_Tronvig Posted May 14, 2014 Author Share Posted May 14, 2014 (edited) Well sure, and having a quick example performing a very simple comparable action would help get me up to speed in a hurry. Could you point me toward a minimal document that would do something like retrieving a screen dimension before generating the actual page? Or I could Google for hours in hopes of finding something like that. Edited May 14, 2014 by Drew_Tronvig Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/#findComment-1479490 Share on other sites More sharing options...
Drew_Tronvig Posted May 14, 2014 Author Share Posted May 14, 2014 Not knowing the terminology, I'd love to get just terms to use in searching for a minimal document that would do something as simple as this. Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/#findComment-1479498 Share on other sites More sharing options...
richei Posted May 15, 2014 Share Posted May 15, 2014 there should be a lot on stackflow. when I was looking for a way to center a div, it took me a few minutes to find it. how much time it takes depends on what you search for. try http://stackoverflow.com/questions/2407221/how-to-get-the-height-of-the-screen-using-jquery (took 30 seconds to find btw) Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/#findComment-1479535 Share on other sites More sharing options...
Drew_Tronvig Posted May 15, 2014 Author Share Posted May 15, 2014 Yeah, I gave up trying to Google up an answer and asked the question at stackoverflow. I got a promising answer, and now I'm just trying to stitch together the parts from that answer into an actual working example. I certainly appreciate the help here, but I was already pretty clear on how to get the values in via jquery. The trick is how to get those values back to the PHP script on the server, hence asking on the AJAX board. Thanks, Drew Quote Link to comment https://forums.phpfreaks.com/topic/288393-how-to-simply-retrieve-the-window-height-before-generating-page/#findComment-1479541 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.