【问题标题】:scrollable <div> becomes draggable when inside <a> tag [duplicate]在 <a> 标签内时,可滚动的 <div> 变为可拖动的 [重复]
【发布时间】:2018-03-02 14:36:11
【问题描述】:

.img {
    width: 200px;
	height: 150px;
	display: block;
	background-position: 50% 50%;
	background-repeat: no-repeat;
	margin: 0px auto;
	background-size: contain;
}
<div>
  <a href="#" draggable="false">
			<div class="img" style="background-image:url('http://i.imgur.com/tI5jq2c.jpg');">
      </div>
      
			<div class="caption" draggable="false" style="height: 150px;overflow: auto;">												 	
	     <h3>
            Title
         </h3>
				 <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
      </div>
  </a>
</div>

当我尝试通过单击它拖动的滚动条来滚动 div 时。我搜索并找到了 draggable="false" 部分,但它仅适用于图像。

我该如何解决这个问题?

【问题讨论】:

  • 您使用的是哪个浏览器?在 Chrome、Edge IE11 和 Opera 上,它按预期工作。众所周知,它不能在 Firefox 中工作,需要 JS 解决方法:stackoverflow.com/questions/26356877/…
  • 是的,看起来差不多。不过,draggable="false" 似乎适用于 Firefox 中的图像。这就是它令人困惑的原因。谢谢。

标签: html css


【解决方案1】:

也许您可以在 &lt;p&gt; 元素上使用一些 CSS。

THIS LINK 中,他们给出了一个明确的例子。

希望能帮上点忙:)

最好的问候, 迪米塔尔·格奥尔基耶夫

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多