简体   繁体   English

试图阻止水平滚动

[英]trying to stop horizontal scrolling

I have created a div and set its initial position 我创建了一个div并设置了它的初始位置

<div class="guide" >
<style>
  .guide{
    height:150px;
    width:200px;
    position:absolute;
    right:-170px;
    top: 10%;
  }
</style>

What i want when i click on the div it should comeout from right side. 当我点击它应该从右侧出来时我想要的是什么。 The problem is window is providing hrizontal scroll, so if a person scrolls to right the div is compltely visible. 问题是窗口正在提供hrizontal滚动,所以如果一个人向右滚动,div就完全可见了。 I want to stop horizontal scroll so that if the user click on div then only its visible. 我想停止水平滚动,这样如果用户点击div,那么只有它可见。 Now if any body explain that why its going after -ve pixels, becouse sometime it doesn't go beyond -ve px, sometime it goes, why? 现在,如果有任何一个机构解释为什么它会追求-ve像素,因为有时候它不会超越-ve px,有时会发生,为什么呢?

Add overflow-x: hidden; 添加overflow-x: hidden; to the Parent element. 到父元素。

Horizontal Scrollbar : overflow-x: hidden; 水平滚动条: overflow-x: hidden;

Vertical Scrollbar : overflow-y: hidden; 垂直滚动条: overflow-y: hidden;

both: overflow: hidden; 两者: overflow: hidden;

使用隐藏父div的垂直滚动条

overflow-x: hidden;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM