【发布时间】: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 中的图像。这就是它令人困惑的原因。谢谢。