사용하지 않는 방법으로 스크롤 막대 JavaScript?
-
05-07-2019 - |
문제
나를 잠글 필요가 브라우저 스크롤 때 나는 쇼 div 을 나타내는 모달 창에서 인터넷 익스플로러 7 니다.인터넷 검색을 나는 할 수 있다는 것을 발견 사용 document.body.style.overflow='hidden'
하지만 이 작동하지 않 IE7.리스도와 함께 document.body.scroll="no"
작동 하지만 난 후에 마우스를 통해 스크롤:-S
누군가 알고있는 더 나은 산도와 경내에 마련된 회장?
Thansks
해결책
에 응답하는 다양한 질문(에는 포함하는 다른 코멘트),나는 당신이 사용하는 위치는 방법입니다.
도 position:fixed
.그것은 기본적으로 동일 position:absolute
그 외에도에서의 상대적인 절대적인 호텔이 있습니다.Ie:는 경우 사용자가 스크롤 항목에서 동일한 위치를 화면입니다.
그래서 마음이와 함께,배치할 수 있습니다 position:fixed
라이버를 사용합니다.에서 가질 수 있다는 당신의 position:absolute
(나 fixed
다시,당신이 선호하는 경우-그 말 이 차이를 만들)모양 상자.
다른 팁
설정하는 모달 중첩 div 를 몸을 채우,경우에도 그래서 그들은 스크롤 아무것도 그들이 할 수 있기 때문에 모든 걸 숨겨진 아래습니다.
할 수도 있습니다 숨기는 스크롤바를 사용하여 overflow:hidden
그래서 사용자가 늘 보 scollbars 그래서 그것은 유혹하는 스크롤하여 주위:)
이것은 당신을 도울 수 있습니다:
documentOBJ = {
/*Width and Height of the avaible viewport, what you'r seeing*/
window : {
x : function(){return (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth; },
y : function(){return (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight;}
},
/*Scroll offset*/
scroll : {
x : function(){return ( document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft; },
y : function(){return ( document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop; }
},
/*Height and width of the total of the xhtml in a page*/
page : {
x : function(){return (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth; },
y : function(){return (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight; }
},
pointer : {}
}