使用javascript代码使用鼠标滚轮垂直滚动div

时间:2017-12-29 10:13:32

标签: javascript html css

我在我的css

中的div上使用了以下属性

溢出-γ:滚动;

垂直滚动也显示但我需要使用鼠标滚轮滚动div当我在div上滚动时,整个页面滚动。

有任何建议吗?

1 个答案:

答案 0 :(得分:0)

希望这会对你有所帮助

/* html, body {
    height:100%;
} */
 .message_wrap {
    height:500px;
}
.message_box {
    border:1px solid #bbb;
    background-color: #B0E0E6;
    padding: 10px;
    width:350px;
    max-height:20%;
    overflow-y:scroll;
    overflow-x:hidden;
}
.message {
    border: 1px solid black;
    background-color:#fff;
    padding:10px;
}
<div class="message_wrap">
    <div class="message_box">
        <p class="message">Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.</p>
        <p class="message">Completely synergize resource sucking relationships via premier niche markets. Professionally cultivate one-to-one customer service with robust ideas. Dynamically innovate resource-leveling customer service for state of the art customer service..</p>
        <p class="message">Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions.</p>
    </div>
</div>