jquery - Enable mouse scroll without vertical scrollbar displayed and maintain the background -
requirement : enable mouse wheel vertical scroll without displaying scrollbar , maintain background.
using below solution, able achieve expected following solution mentioned below
<div style='overflow:hidden; width:200px;'> <div style='overflow:scroll; width:217px'> mousewheel scrollable content here.... </div> </div>
link : remove html scrollbars allow mousewheel scrolling
the issue have inside child div, there table alternate colors , styling , maintain background. currently, using above solution, scrollbar area of 17px empty , looks has rubbed off scrollbar. questions :
(a) how can maintain background ?
(b) can reduce width of vertical scrollbar 1px appears thin line , users not notice existence of scrollbar.
tried different solution using jquery avoid background problem //my page split 2 sections div1 , div2 //div1 - div on left hand side //div2 - div on right hand side //on scrolling mouse in either of divs, other div should move up/down tried below code , works. hope helps $( '#div1' ).bind('mousewheel', function(event, delta, deltax, deltay) { console.log(delta, deltax, deltay); var panelpos=$('#div2' ).scrolltop(); $( '#div2' ).scrolltop(panelpos - (deltay * 30)); $( '#div1' ).scrolltop($('#div2').scrolltop()); });
Comments
Post a Comment