[英]Finding where onclick event is set for a div?
By using a web inspector I've found a 通过使用网络检查器,我发现了
<div id="logo">
which when you click refreshes the page. 单击时刷新页面。 It is the containing div for the link logo and image logo.
它是链接徽标和图像徽标的包含div。
I don't want this behavior. 我不要这种行为。
How can I find out where it is being set to do this? 我如何找出要在哪里设置呢?
It is for the main logo here on the front page here: 这是首页的主要徽标,位于此处:
www.papermepress.com www.papermepress.com
If you notice the whole top is click-able. 如果您注意到整个顶部都是可单击的。 I only want the logo to be clickable.
我只希望徽标是可单击的。
It isn't the <div>
causing your page to refresh, it is the <a>
contained inside it. 不是导致页面刷新的
<div>
,而是其中包含的<a>
。 The logo is linked to the home page, a universally common practice. 徽标链接到主页,这是普遍的惯例。
<div id="logo" class="grid_24">
<a href="http://papermepress.com" title="Paper Me"><img src="http://papermepress.com/wp-content/uploads/2012/10/PMP_logocopy1.png"></a>
</div>
Though its dimensions are much smaller than the parent <div id='logo'>
, the <img>
has display: block;
尽管其尺寸比父
<div id='logo'>
小得多,但<img>
具有display: block;
so the containing <a>
will fill the entire parent <div id='logo'>
. 因此包含的
<a>
将填充整个父级<div id='logo'>
。 If you remove that display: block;
如果删除该
display: block;
the containing <a>
won't expand to fill the whole parent <div id='logo'>
and only the image area itself will be clickable. 包含的
<a>
不会扩展为填充整个父级<div id='logo'>
,只有图像区域本身是可单击的。
/* in style.css */
#logo img {margin:0 auto; text-align:center; display:block; margin:0 auto;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.