DEMO
Problem: I am using ScrollSection plugin & having a problem with inner div scroll. i.e inside a section there is a div with scroll but when i hover over it to scroll the div, it scrolls the page instead.
What I have tried: I have added a global Boolean variable(named disableScrollSectionMouseWheel
) inside the core file of scrollSection plugin which can pause it's functionality of mouse-wheel, Using this switch i have added an event for mouse enter and leave on div, it does stops the page scroll but does not turn on the div scroll!!.
By the way i have created a simple version of this issue in jsFiddle but later i have to integrate it with scroll-magic on this site.
CODE:
$(function() {
disableScrollSectionMouseWheel = 0;
scrollSectionsController = $('section.scrollsections').scrollSections({
speed: 2000,
touch: false,
mousewheel: true,
exceptions: true,
scrollMax: 1,
exceptions: true,
alwaysStartWithFirstSection: true,
scrollbar: true
});
/* My Script To pause on hover */
$('section.scrollsections .title').hover(function(e) {
if ($(this).hasScrollBar()) {
disableScrollSectionMouseWheel = 1;
}
});
$('section.scrollsections .title').mouseleave(function(e) {
disableScrollSectionMouseWheel = 0;
});
});
(function($) {
$.fn.hasScrollBar = function() {
return this.get(0).scrollHeight > this.height();
}
})(jQuery);