IE +溢出:隐藏 [英] IE + overflow: hidden

查看:215
本文介绍了IE +溢出:隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是一个问题还是错误,但当我使用 overflow:hidden 时,选择文本并将光标移动到IE中的页面底部,页面滚动(我试过IE9-IE11)!当我使用Firefox / Opera / Chrome / Safari时,页面不会滚动...我必须使用 overflow:hidden ,但它在IE中有一个奇怪的行为。

I don't know is that an issue or bug, but when I use overflow: hidden, selecting the text and moving the cursor to the page bottom in IE, the page is scrolling (I tried IE9-IE11)! When I use Firefox/Opera/Chrome/Safari the page isn't scrolling... I have to use overflow: hidden, but it has an odd behavior in IE.

所以,我的问题是:如何避免IE中的页面滚动?

So, my question is: how can I avoid page scrolling in IE?

推荐答案

使用 -ms-scroll-limit:0 0 0 0; 以防止在IE 10+中进行任何滚动。
对于旧版浏览器,您可以使用JavaScript编写解决方法。

Use -ms-scroll-limit: 0 0 0 0; to prevent any scrolling whatsoever in IE 10+. For older browsers you can write a workaround using JavaScript.

CSS和JavaScript示例:

Example of CSS and JavaScript:

body {
  overflow: hidden;
  -ms-scroll-limit: 0 0 0 0;
}



window.onscroll = function (event) {
  window.scrollTo(0, 0);
}

window.onscroll = function (event) {
  window.scrollTo(0, 0);
}

body {
  overflow: hidden;
  -ms-scroll-limit: 0 0 0 0;
}

    We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win.

    We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win.

    Never in all their history have men been able truly to conceive of the world as one: a single sphere, a globe, having the qualities of a globe, a round earth in which all the directions eventually meet, in which there is no center because every point, or none, is center — an equal earth which all men occupy as equals. The airman's earth, if free men make it, will be truly round: a globe in practice, not in theory.

    What was most significant about the lunar voyage was not that man set foot on the Moon but that they set eye on the earth.

    If you could see the earth illuminated when you were in a place as dark as night, it would look to you more splendid than the moon.

    When I orbited the Earth in a spaceship, I saw for the first time how beautiful our planet is. Mankind, let us preserve and increase this beauty, and not destroy it!

    Buy why, some say, the moon? Why choose this as our goal? And they may as well ask why climb the highest mountain?

    Across the sea of space, the stars are other suns.

    Many say exploration is part of our destiny, but it’s actually our duty to future generations and their quest to ensure the survival of the human species.

    As we got further and further away, it [the Earth] diminished in size. Finally it shrank to the size of a marble, the most beautiful you can imagine. That beautiful, warm, living object looked so fragile, so delicate, that if you touched it with a finger it would crumble and fall apart. Seeing this has to change a man.

    If you could see the earth illuminated when you were in a place as dark as night, it would look to you more splendid than the moon.

    We have an infinite amount to learn both from nature and from each other

    To go places and do things that have never been done before – that’s what living is all about.

    Spaceflights cannot be stopped. This is not the work of any one man or even a group of men. It is a historical process which mankind is carrying out in accordance with the natural laws of human development.

    Space, the final frontier. These are the voyages of the Starship Enterprise. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before.

    To be the first to enter the cosmos, to engage, single-handed, in an unprecedented duel with nature—could one dream of anything more?

    We have an infinite amount to learn both from nature and from each other

    Many say exploration is part of our destiny, but it’s actually our duty to future generations and their quest to ensure the survival of the human species.

    NASA is not about the ‘Adventure of Human Space Exploration’…We won’t be doing it just to get out there in space – we’ll be doing it because the things we learn out there will be making life better for a lot of people who won’t be able to go.

    Never in all their history have men been able truly to conceive of the world as one: a single sphere, a globe, having the qualities of a globe, a round earth in which all the directions eventually meet, in which there is no center because every point, or none, is center — an equal earth which all men occupy as equals. The airman's earth, if free men make it, will be truly round: a globe in practice, not in theory.

    Where ignorance lurks, so too do the frontiers of discovery and imagination.

    Astronomy compels the soul to look upward, and leads us from this world to another.

    We have an infinite amount to learn both from nature and from each other

    Curious that we spend more time congratulating people who have succeeded than encouraging people who have not.

    Where ignorance lurks, so too do the frontiers of discovery and imagination.

    Curious that we spend more time congratulating people who have succeeded than encouraging people who have not.

    Where ignorance lurks, so too do the frontiers of discovery and imagination.

    A Chinese tale tells of some men sent to harm a young girl who, upon seeing her beauty, become her protectors rather than her violators. That's how I felt seeing the Earth for the first time. I could not help but love and cherish her.

    What was most significant about the lunar voyage was not that man set foot on the Moon but that they set eye on the earth.

    That's one small step for [a] man, one giant leap for mankind.

overflow:hidden 在浏览器中显然不一致,但我不知道哪个浏览器做得正确。)

(overflow: hidden is apparently inconsistent across browsers, but I do not know which browser does it right.)

这篇关于IE +溢出:隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆