Adarchy
Adarchy

Reputation: 551

jQuery mousewheel prevent default only in some cases

I've got simple page that has horizontal scrolling with jquey.mousewheel plugin and $('html, body').mousewheel();

Inside I've made horizontal scrolling and used event.preventDefault(); - to prevent scrolling it vertically. But I have one class of divs with comments sections witch I want to be scrolling vertically when that div is hovered and mousewheel is used. But prevent default block it.

So how to disable global horizontal scrolling and enable normal werical inside div only when mouse is hovering it?

Upvotes: 0

Views: 343

Answers (1)

vasanth kumar
vasanth kumar

Reputation: 59

Please consider using this code:

$('html, body').not(".nomousewheel").mousewheel();

This selector will not apply the function on the elements with class .nomousewheel.

Upvotes: 1

Related Questions