Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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?

greatwindowsss
Beginner Modder
ranks
useravatar
Offline
1 Posts
User info in posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10137
Newest User:
lexispoker1
Members Online:
0
Guests Online:
357

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