SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Posts
    341
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fixed nav jumping all over the place

    This is only a problem on an iPhone. Not tested on other mobiles, but can't replicate on a desktop. I do believe this is a question for a 'CSS' expert rather than a 'mobile' expert though.

    If I add this code:
    Code:
    	position:fixed;
    	top:0;
    	background:yellow;
    to a <div> then it sticks at the top of the page without any problems.

    It also works perfectly on the iPhone. However, if you visit the page and append a named anchor to it (e.g. page.html#content) then it jumps around when scrolling.

    I have a demo here:
    http://www.page-test.co.uk/fix.html (works fine)

    http://www.page-test.co.uk/fix.html#hello (fixed nav jumps around)

    Sorry if this is obvious, but if testing on an iPhone and you visit the first link, you can't just visit the second link. You need to either visit it and refresh the page, or open a new window.

    If you go straight to the second link without visiting the first then it will show the problem (on an iPhone).

    In real world use, if someone clicks a link to jump to a named anchor and then refreshes the page for whatever reason, they will see the problem.

    Any ideas?

  2. #2
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,889
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    I tried validating both links and only a warning was shown about "No Character encoding declared at document level".


    http://validator.w3.org/

    I would try fixing that warning and also enclose your "Lorem ipsum dolor sit amet, consectetur adipisicing elit..." in a div block.
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •