我希望有一个图像热点,将用户链接到单页滚动网站的另一部分。它工作到目前为止,但你只能点击图像上的文字,我怎么能这样做,所以整个图像是一个链接?
<div class="quarter-column">
<div class="welcome_square">
<img src="/pageassets/freshers2016/info.jpg" alt="" />
<a href="#info"><h2>NEED TO KNOW</h2></a>
</div>
</div>
<div class="clearfix" id="page2">
<a id="info" class="smooth"></a>
<div class="full-column" id="tiles">
<h2>NEED TO KNOW</h2>
</div>
</div>
答案 0 :(得分:2)
您需要将img
元素放入a
链接元素中,请检查:
<div class="quarter-column">
<div class="welcome_square">
<a href="#info">
<img src="/pageassets/freshers2016/info.jpg" alt="" /> <!-- <img/> inner <a/> link element -->
<h2>NEED TO KNOW</h2>
</a>
</div>
</div>
<div class="clearfix" id="page2">
<a id="info" class="smooth">
<div class="full-column" id="tiles">
<h2>NEED TO KNOW</h2>
</div>
</a>
</div>