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 8821965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:58:54+00:00 2026-06-14T05:58:54+00:00

When my site is using the mobile css the navigation becomse so long, that

  • 0

When my site is using the mobile css the navigation becomse so long, that the user dose not see the conctent unless they scroll down.

I then want to change the navigations urs to link to divs so it’s jumps right down to the content

exsampel:

When @media only screen and (min-width: 480px) is in use the navigations links have the url

site1.php#content

site2.php#content

site3.php#content

When @media only screen and (min-width: 992px) is in use

site1.php

site2.php

site3.php

How should i do this? PHP og jQuery ?

I lookt at this code:

$("a[href^='http://stackoverflow.com']")
   .each(function()
   { 
      this.href = this.href.replace(/^http:\/\/beta\.stackoverflow\.com/, 
         "http://stackoverflow.com");
   });

Will it be possible to modify this in a way so it wil work i my case?

  • 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-06-14T05:58:55+00:00Added an answer on June 14, 2026 at 5:58 am

    If you are setting the name of the element that you wish for the page to scroll to, we can do.

    $(function(){
        var hash = (window.location.hash) ? window.location.hash : null;
        if(null !== hash){
            //now I don't know how the markup is designed, so we'll just use `id`
            $(window).scrollTop($('[id='+hash+']').scrollTop());
        }
    });
    

    On page load, we create a variable called hash, we see if the hash is present, if it is, we use the hash value, otherwise, we null it. In our conditional, we tell the window to scroll until the window reaches the to of the element we define as the value, which for our example, is the id of an element matching the hash value.

    Now, I don’t know how you generate the variable content, there must be some attribute within your <a> element that contains the value you want. If you show me how you plan to reference the element, I will connect the missing links.

    Edit — in response to your comment.

    $('.main-menu a').prop('href', function(a,b){
        return b+'#content';
    });
    

    Here’s your jsFiddle — Check the console so you don’t have to waste time in specting.

    Edit #2 — In response to mobile detection.

    Instead of using media queries, I use user agent sniffing. It’s a pretty common technique. The guys over at http://detectmobilebrowsers.com/ provide a script we can use to check the user agent for the presence of many known and popular mobile devices.

    Check the jsFiddle out over here.

    Simply take the large block of code and place it in a flie like `mobileDetect.js’.

    Anything below the //comments is an implementation of the code I’ve written above, and is placed accordingly in the conditional statement. I tested this on a few devices, and it works well.

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

Sidebar

Related Questions

I'm developing a mobile site using IUI . It's a framework that makes web
I have a bunch of CSS written that makes my site target Mobile first,
I am building a mobile site using jquery.mobile-1.0b3.min.css. If I download the css file,
I've built a mobile site using a CSS sprite for some of the icons
I am developing a mobile site, so I'm using CSS to make things as
I have a HTML+CSS mobile website (not a real app) that is supposed to
I am developing a site for mob using jquery mobile. I have a content
Im working on a mobile optimised site. Im using media queries to detect the
I developed a site using twitter bootstrap and it seems that the responsive layout
I have an existing mobile site which I am using Phonegap to turn into

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.