Question

I have map image area such as:

 <area shape="circle" coords="60,59,20"  href="#div1" item="list1">

And I use following function to show/hide my div:

<!-- jQuery Plugin -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$('[item]').click(function(){
    var item=$(this).attr('item');
    $(".display").hide();
    $("#"+item).show();
    return false;
});
</script> 

And in body I have

<div id="list1" style="display:none;">Test</div>

I click on the area map and the div shows correctly, but the anchor to the div does not work. Why? Thanks

Était-ce utile?

La solution

Add an a element with attribute name="div1" before your div:

<a name="div1"></a>
<div id="list1" style="display:none;">Test</div>

This is how anchors works, example:

<a href="#anyword">Jump to any place</a>
...
<a name="anyword">Jump to this place</a>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top