• Hello, I need create button to my web where after click will change version of the web when is customer on desktop from webpage.com to m.webpage.com and when is on mobile phone from m.webpage.com to webpage.com. I have two css files – mobile.css and style.css. How can do this or how can I create something like this? I would like to create one css file with responsive styles and when customer click to button this will be switch to other device. But I don’t know how. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Mark:

    Rather than have two css files and rely on the user to select the right one, build something responsive.

    Google “@media CSS” to learn how to qualify your CSS styles by device width (and possibly other characteristics).

    Thread Starter 17Mark

    (@17mark)

    Yes I know media queries but I need button on the webpage. If it had done so in my opinion I would use it simply media queries but I must add this button and I don’t know how could I launch required part of code.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    here’s one option:

    make your style.css file just a stub and have two other CSS files, desktop.css and mobile.css. In your functions.php, look at whether your site is m.site.com or just site.com and then enqueue the appropriate CSS file. Your button would simply reload the current page on either m.site.com (if you’re on the desktop) or site.com (if on the mobile). You’d use PHP similar to what you’d use in functions.php to figure out which you should use.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Mobile version website’ is closed to new replies.