Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Problem
Problem
Problem
I have a problem with a module that does not changes size according to window width. So I have to try to find a solution and maybe metamod is the solution. Is there any way to get the screen/window size in a variable to show or not a module?
Re: Problem
Hi,
unfortunately there's no built-in way to do this with MetaMod, as MetaMod doesn't know about screen/window width. If you can make some JS code on your page that sets a cookie containing this information, then it is pretty easy to get MetaMod to pick this up from the cookie and use this to decide whether to include a module or not, or to switch which module it's going to include.
The only problem with this approach is that it won't and can't work on the very first page that the visitor requests. That's because:
1 - the client requests the page
2 - Joomla receives the request and generates the page
3 - the client receives the page and runs the JS -- and at this point the 1st page has already been sent and displayed, before the JS could discover the screen/window width
4 - the JS sets a cookie
5 - if/when the client requests the NEXT page, then the cookie will be sent to Joomla, and MetaMod would be able to pick it up and know the screen/window width.
See what I mean?
There's a good discussion on the ins and outs of this sort of approach here: http://css-tricks.com/single-page-refre … rver-side/
Hope that helps,
Regards,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Problem
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 176
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked