Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7056813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:54:42+00:00 2026-05-28T03:54:42+00:00

I need to adapt my template to mobile versions, without creating different page files

  • 0

I need to adapt my template to mobile versions, without creating different page files for each case, or subsites. I think the easiest way to do that is to change the css files to “rearrange” some elements.

So this is what I´ve done so far:

  • I´m working with php.

  • I´ve made use of @media queries, adding inside the <head> this: <link rel="stylesheet" type="text/css" media="only screen and (max-width: 700px)" href="/css/smartphones.css" />, so it will call the smartphones.css file each time the users access the site with a small device.

  • Everything goes kinda smoothly, up until now, when I decided to adapt the dropdown menu.
    I´ve got a dropdown menu in pure css, that gets activated on mouse over. I use :hover to get the menu to actually drop down.

I want to replace that big dropdown menu with many items (horizontally and vertically), to a single button, that onclick will dropdown, and show just a couple of things.

In order to do that I need to adapt my php page file to hidden the entire dropdown menu and show the “mini-onclick” dropdown menu instead. And here is what I don´t know how to do it.

I need some -javascript I guess- inside my body tag (as the menu appears inside the body) to say something like:

IF the screen is less than 700px, show this XXXX code. ELSE keep going with the rest of the page.

I´m planning to hide the normal dropdown menu using css inside the smartphones.css file, but don´t know how to show the special dropdown menu instead.

Any help will be greatly appreciated! THANKS!

Rosamunda

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:54:43+00:00Added an answer on May 28, 2026 at 3:54 am

    You can use the User-Agent HTTP header in PHP to determine if smartphone-relevant code should be generated instead of normal code.

    You could also get screen properties via the screen object, and if it’s a smartphone, attach the dropdown state to the onclick event and if not to the onmouseover event.

    That’s pretty simple. You just change your CSS from someclass:hover to someclass.hoverstate and when the dropdown needs to be triggered, you add the hoverstate class to the target element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to adapt a two parameter template to a one parameter template. I
Need to insert selected text on the page into textarea. There must be some
need to add a 2nd css stylesheet to a page. do i add a
I need to be able to return a list of files that meet some
For the application I am currently developing, I need to adapt the layout of
I have 5000 vectors which are held in 5000 files. I need to find
I need to break apart a large collection of wav files into smaller segments,
I need to adapt lucene's StandardTokenizer to some special purposes regarding twitter data. At
I have the following script that I need to adapt to read from a
Let's assume I've got a class SomethingDAO which I need to adapt to an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.