![](/img/trans.png)
[英]How do I enable horizontal scrolling with the mouse wheel using Javascript and PHP
[英]How would I enable zoom using mouse wheel?
我有一個圖像庫,用戶只需使用鼠標即可導航。
我希望他們能夠使用鼠標滾輪以及雙擊來放大和縮小。
做這樣的事情怎么樣:
var mousewheelevt=(/Firefox/i.test(navigator.userAgent))? "DOMMouseScroll" : "mousewheel" //FF doesn't recognize mousewheel as of FF3.x
if (document.attachEvent) { //if IE (and Opera depending on user setting)
document.attachEvent("on"+mousewheelevt, function(e){
alert('Mouse wheel movement detected!')})
} else if (document.addEventListener) { //WC3 browsers
document.addEventListener(mousewheelevt, function(e){
alert('Mouse wheel movement detected!')
}, false)}
為了進行縮放,您可能需要使用 Javascript 和 CSS 做一些額外的工作,例如:
.zoom {
zoom: 150%;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.