Kaworru / jscroller2

Automatically exported from code.google.com/p/jscroller2
0 stars 1 forks source link

soultion to hard code in start_stop method causing more than 5 elements trees to malfunction #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create more than 5 nested elements that need to be scrolled:
<div class="jscroller2_up jscroller2_speed-20 jscroller2_mousemove">
<div>
<ul>
<li>
<div>
<div>
<a href="#">SOME ANCHOR TEXT</a>
</div>
<div>SOME REGULARE TEXT</div>
</div>
</li>
</ul>
</div>
</div>
2. notice that when you hover on top of the anchor element, the scrolling does 
not stop.

What is the expected output? What do you see instead?
When you hovering over jscroller2_mousemove child element in ANY depth the 
scrolling should be stopped.

What version of the product are you using? On what operating system?
1.61

Please provide any additional information below.

The solution is quite easy. instead of assuming only 5 possible elements 
parents - why not traversing?

instead of: line 474 -480:
for (var i=0;i<5;i++) {

}

use:

            while (evt_src.parentNode != null)
            {
                if (evt_src.className.indexOf( ByRei_jScroller2.cache.prefix + 'mousemove') < 0 && evt_src.className.indexOf('_endless') < 0) {
                    evt_src = evt_src.parentNode;
                } else {
                    break;
                }
            }

Original issue reported on code.google.com by bar...@gmail.com on 8 Jul 2013 at 7:18

Attachments: