Question 1: The parent element has no element quilt distraction?
Solution: to ensure that the parent element has no width / height restrictions, overflow hidden, not enough, then, to the parent element plus float: float: left
Generating an overflow scrollbar: overflow-x: scroll overflow-y: scroll
Change the scroll bar style: xxx :: - webkit-scrollbar {...}
/ * High Aspect broadest definition and background scroll bars respectively corresponding dimension of the vertical scroll bar * / .div :: -webkit- ScrollBar { width: 16px; height: 16px; background - Color: # f5f5f5; } / * defines scrollbar track the shadow fillet + * / :: -webkit-scrollbar- track { -webkit-Box-shadow: the inset from 0 0 6px RGBA (0,0,0,0.3 ); border - RADIUS: 10px; background - Color: # f5f5f5; } / * defines the slider within the shaded fillet + * / :: -webkit-scrollbar- Thumb { border- RADIUS: 10px; -webkit-Box-Shadow: the inset from 0 0 6px RGBA (0,0,0, .3 ); background -color: # 555 ; } // ,,,,,,,,,,,, examples ,,,,,,,,,,,,,,, 2 / * set the style scroll bar * / :: -webkit- scrollBar {width: 12px;} / * rolling groove * / :: -webkit- scrollbar- Track { -webkit-Box-Shadow: the inset from 0 0 6px RGBA (0,0,0,0.3 ); border - RADIUS: 10px; } / * scrollbar slider * / :: -webkit-scrollbar- Thumb { border - the RADIUS: 10px; background: rgba(0,0,0,0.1); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); } ::-webkit-scrollbar-thumb:window-inactive { background: rgba(255,0,0,0.4); }
Question 2: When rolling,
ele.scrollTo (0,100) when using the scroll bar, so that the element scroll to the specified location, unit px