ElkArte Community

Elk Development => Feature Discussion => Exterminated Features => Topic started by: TE on January 10, 2014, 02:47:20 am

Title: Options for mobile phones
Post by: TE on January 10, 2014, 02:47:20 am
Just a question, maybe it's easy to implement (havent checked the related code details yet):
I'd like to force the usage of "click menu" instead of the hover menus for mobile phones.  Is it just the javascript var use_click_menu that needs to be true? How would I check, if the device (browser) is from a mobile phone?
Title: Re: Options for mobile phones
Post by: emanuele on January 10, 2014, 05:00:03 am
Yep, should be the only value.
I don't think we have any mobile detection in javascript, but we can drop in a variable from the php detection I think.
Alternatively you can do some "responsive-like" javascript measuring the width of the screen (and/or attaching an event to resize or whatever is called, but maybe that's not necessary) and set the variable accordingly.
Title: Re: Options for mobile phones
Post by: Spuds on January 10, 2014, 10:01:35 am
Yup, all you should have to do is set that var and the click menus will activate.

We don't have specific mobile capability detection, ("robust" detection), but the UA quick sniff  does its best to check for the following mobile type devices 'is_iphone' , is_android, 'is_blackberry' , 'is_nokia',  'is_ipad', is_tablet_pc, is_ie_mobi, 'is_opera_mobi' etc.

One easy way to check what it finds is that it will set $context['browser_body_id']  to 'mobile' or 'tablet' if it feels that is what is being used, otherwise it will have the more standard firefox, chrome, etc.  I don't think we have a generic isBrowser('is_mobile') check but one could be added, so till then just use if  $context['browser_body_id'] === 'mobile' as a start
Title: Re: Options for mobile phones
Post by: emanuele on February 01, 2014, 04:09:31 am
If I'm not wrong that was implemented... if not feel free to move it back. O:-)
Title: Re: Options for mobile phones
Post by: TE on February 01, 2014, 06:51:07 am
Yep