We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Guys,

    Would it be possible to use the Evo version of Mobile Template Switcher to detect mobile AND tablet and therefor server the relevant template / sections of code specific to DESKTOP, TABLET and MOBILE - e.g. rather than just DESKTOP and MOBILE. Is this possible? Can anyone advise on how the plugin could be adapted to work like this?

    Appreciate your thoughts...
      • 38290
      • 712 Posts
      You could always just go mobile first and write responsive CSS. Template switchers are yucky, complicated and on their way out
        jpdevries
        • 22840
        • 1,572 Posts
        I use javascrip, a new set of templates and GetResorces to pull in the same content:

        If Mobile
        <script type="text/javascript">
        <!--
        if (screen.width <= 720) {
        document.location = "http://www.mysite.co.uk/mobile.html";
        }
        //-->
        </script>

        If Desktop
        <script type="text/javascript">
        <!--
        if (screen.width >= 721) {
        document.location = "http://www.mysite.co.uk";
        }
        //-->
        </script>


        But as said it would be better to build a responsive site if the funds / time is there
          • 8168
          • 1,118 Posts
          @jpdevrise thanks - but true responsive wont cut the mustard here. Client wants different functionality and also layout here, not just re floating layout by CSS... These situations are when device centric template versions will always exist. Is it possible to adapt the mobile template switcher to have x3 versions rather than 2?
            • 38290
            • 712 Posts
            I get it, I know nothing of the project. More so just pointing out IMO this problem often starts before development. It's often a false notion to think the same content isn't relevant across multiple devices. If you agree tell your client they are wrong wink.
            I know it may seem "pages need to be lighter for speed" for mobile devices but is loading one DOM, detecting viewport with JS, and then redirecting to another page really faster?
            Different interaction sure, that can be handled by detecting .touch vs .no-touch or of course viewport size but let's not forget, that can change at any time.
            You can do a lot now but once position:sticky lands in CSS3 I think we will see a lot more creative uses of adapting even large amounts of content to mobile without hiding them.
              jpdevries
              • 8168
              • 1,118 Posts
              Thanks guys. I'd love to design the site to work well across all devices considering smallest first... But this is a retro fit solution... Making a desktop site work in a responsive way to suit smaller devices... Not the ideal route - hence why the template switcher seems more logical.