javascript - Locating content on page with nested(?) anchor tags? -


asume website domain.com, store page, domain.com/store adding id = "itemid" every item can let users visit item directly by:

domain.com/store#itemid 

usual anchor behavior. however, need little more complex.

assume item hierarchy follows:

<div id="item1>    <div class="images"></div> </div> 

i want user directly reach "images" box of given item using anchor-like addressing. such as

domain.com/store#itemid.images 

what's best approach this?

something should work, split hash 2 parts: id , class use using javascript or jquery find element , scroll view.

hash = window.location.hash.split('.') document.getelementbyid(hash[0]).getelementsbyclassname(hash[1])[0].scrollintoview(true); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -