js scroll page horizontally with mouse wheel
(function() {
function scrollHorizontally(e) {
e = window.event || e;
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
document.getElementById('yourDiv').scrollLeft -= (delta * 40); // Multiplied by 40
e.preventDefault();
}
if (document.getElementById('yourDiv').addEventListener) {
// IE9, Chrome, Safari, Opera
document.getElementById('yourDiv').addEventListener('mousewheel', scrollHorizontally, false);
// Firefox
document.getElementById('yourDiv').addEventListener('DOMMouseScroll', scrollHorizontally, false);
} else {
// IE 6/7/8
document.getElementById('yourDiv').attachEvent('onmousewheel', scrollHorizontally);
}
})();
Also in JavaScript:
- nodejs format text
- javascript exercism.io bob solution
- nodejs map
- javascript forever loop
- various elements of jsp document
- first n elements of array js
- js int to string base
- subtrair datas javascript frontend
- how to get href value of anchor tag in jquery
- open pdf in new tab javascript
- javascript change button text onclick
- format JSON code javascript
- convert hashmap into json
- jimp get image size
- how to create uuid in javascript
- how to exclude a specefic tagname from a javascript query search
- cell get row google script
- create angular project cli version 8
- js match true false
- javascript truncate string full word
- chrome add a javascript bookmark
- javascript get ur
- discord.js custom create channel
- how to install chalk in node js