0

I have some horizontal div inside long verical aera I want keep big vertical div scroll working inside body with mouse wheel (lift icon), I want also keep all my horizontal scrollbar: travelator icons But Disabled horizontal mouse wheel only of all my horizontal DIV's when mouse is hover in horizontal DIV area only AND work again when hover is exactly on the horizontal scrollbar

I didn't find javascript code that work

enter image description here

  • you can do this with css. Add overflow-x: hidden; Also javascript is not the same as java :) – Yasin Yaqoobi Jul 10 '16 at 21:38
  • Please show what efforts have you taken to solve your problem. Include coding to show your own work. – Shyam Bhimani Jul 10 '16 at 21:41
  • Its new to me that you can scroll horizontally when theres the possibility to scroll vertically also. Is there a mouse that can do that?? – prizm1 Jul 14 '16 at 07:58
  • http://stackoverflow.com/questions/3656592/how-to-programmatically-disable-page-scrolling-with-jquery here you can find a piece of code, that fixes the position by resetting it to state previous of the scroll action, maybe you can fix it up to just enable it for the intended direction – prizm1 Jul 14 '16 at 07:59
  • this one no work propbably because there is anoher div inside the container: $('#container').hover(function() { $(document).bind('mousewheel DOMMouseScroll',function(){ stopWheel(); }); }, function() { $(document).unbind('mousewheel DOMMouseScroll'); }); function stopWheel(e){ if(!e){ /* IE7, IE8, Chrome, Safari / e = window.event; } if(e.preventDefault) { / Chrome, Safari, Firefox / e.preventDefault(); } e.returnValue = false; / IE7, IE8 */ } – Georges Koussouros Jul 21 '16 at 09:46
  • I think this javascript I use no permit disable http://www.hesido.com/web.php?page=customscrollbar – Georges Koussouros Jul 21 '16 at 15:26

2 Answers2

1

You may do it with javascript, but theese are simple operations with css via JS:

[your element].style.overflowY = "scroll";
[your element].style.overflowX = "hidden";

That should work)

Dzi Lean
  • 89
  • 6
  • Thank you a lot Dzi. ...I want keep show all my 10 horizontal scrollbars; only disable mouse wheel and only disable when it's is on text area, no disable when hover on horizontal scrollbar – Georges Koussouros Jul 20 '16 at 15:28
  • This code no work : $('#container').hover(function() { $(document).bind('mousewheel DOMMouseScroll',function(){ stopWheel(); }); }, function() { $(document).unbind('mousewheel DOMMouseScroll'); }); function stopWheel(e){ if(!e){ /* IE7, IE8, Chrome, Safari */ e = window.event; } if(e.preventDefault) { /* Chrome, Safari, Firefox */ e.preventDefault(); } – Georges Koussouros Jul 21 '16 at 06:08
0

You can do this by just using this css to your div

overflow-y: scroll;
overflow-x: hidden;
Anwar Hossain
  • 654
  • 6
  • 21