Tuesday 15 July 2014

css - Scroll html page to specific tag and stay in focus even though dynamic content is being added in the page -


I have a page that's dynamically a & lt; Img & gt; Inserts the images in the form of a & lt; Div & gt; , many of these & lt; Div & gt; . Each & lt; Div & gt; above and lt; H1 & gt; The text has a unique ID, such as when I use that ID in an anchor tag, the page will scroll down to & lt; H1 & gt; and & lt; Div & gt; Show Container The problem occurs when the Ajax code takes seconds to fetch the page from someone else, for example, and for example, many & lt; Div & gt; The height of the containers varies, before the images the page scrolls with the "office" tag, the time of the insert Containers that I can scroll to other & lt; Div & gt; The height of the containers was trying to be lost as a change.

Is there a way to focus the browser & lt; Div & gt; , and scroll up and down according to the dynamic changes in the page? And when the user clicks or scrolls manually, can the focus break?

Thank you.

I think the best option is to set the height of the divisions with images so that the page is always fixed Height Then when it scrolls down, the images will not be out of position when loading.

You can also look at javascript to see if there is a URL in #, and then stop jumping to the page is completely full.

Check the hash with

  (if location.hash) {// stopped scroll window. ScrollTo (0, 0); // Add the function to wait until the page is fully loaded / scroll to the anchor}    

No comments:

Post a Comment