davetayls / jquery.kinetic

Add kinetic scrolling functionality to a container using mouse or touch devices
http://davetayls.me/jquery.kinetic
MIT License
420 stars 86 forks source link

Scroll on body not working in IE & FF newest version #59

Closed TimoRuetten closed 10 years ago

TimoRuetten commented 10 years ago

jQuery('body') is not working with kinect on IE && FF (newest versions on WIN7). Chrome works fine.

TimoRuetten commented 10 years ago

Update:

IE: jQuery('body, html') also do not working. jQuery('html') "works" - but not in the rigth way. It is possible to dra to scroll. But when dragging again to scroll the body scrolls automaticly back to position 0;0

FF: jQuery('body, html') is not working. jQuery('html') is working fine.

Maybe take a look at http://rawgithub.com/debiki/utterscroll/master/utterscroll-example.html

This works fine with another plugin. I dont know why, but there are no problems. Its sad because the other Plugin isnt that smooth like your plugin, but i need to be lauchnable in IE & FF

davetayls commented 10 years ago

can you create an example using jsfiddle so we can replicate the error

TimoRuetten commented 10 years ago

http://jsfiddle.net/BUCZ2/1/

Here you can see it. I called your plugin in the last row of the javascript code. Its defined for "html" because "body" does not work

davetayls commented 10 years ago

i've had to update the way you're building this but it seems that firefox works when you attach it to html and chrome works when you attach it to body

firefox works in this: http://fiddle.jshell.net/BUCZ2/5/show/light/ chrome works in this: http://fiddle.jshell.net/BUCZ2/6/show/light/

you need to look in to an unobtrusive way of detecting which the browser is expecting and submit a pull request.

alternatively don't attach to the body. use a wrapper div which fills the window

TimoRuetten commented 10 years ago

In my case i cant use a wrapper and i have to use the body. I know that the FF works fine with html - in my project i already have a browser detection for FF and this works fine.

I am glad to hear that u want to update this. Do you know when this will happened ?

davetayls commented 10 years ago

yeah FF works with html but not with body and chrome works with body but not with html.

if you are able to take a look and suggest a fix we can get it in

skovhus commented 10 years ago

@Visudare: a temporary workaround:

var attachElement = $.browser.mozilla ? 'body' : 'html';
$(attachElement).kinetic();
TimoRuetten commented 10 years ago

@skovhus: Thanks, but i already had a workaround (see the second post of me).

Btw the $.browser variable does not work in the newer versions of jQuery. So if you use this workaround for your scripts beware of errors in your scripts!

Edit: My live workaround: $(((!(window.mozInnerScreenX == null)) ? 'html' : 'body')).kinetic();

TimoRuetten commented 10 years ago

I was not allowed to push my changes so i did a fork. you can find it here:

https://github.com/Visudare/jquery.kinetic

now it works fine for me.

davetayls commented 10 years ago

a better way of doing this might be to have a method which sets the scroll positions and inside check to see if the scroller element is body or html.

if it is then use $(window).scrollTop(...) etc as that seems to be more consistent

TimoRuetten commented 10 years ago

The problems seems to be when setting the HTML on focus. When this is done in IE the scrollPosition will set to (0,0) - its jumping to the focused element.

I dont know why you are setting the focus on EL but you do it - when i outcomment it everything works fine anyway and also in IE without errors.

davetayls commented 10 years ago

I'm closing this in favour of #61 - please checkout that branch and test using $('body').kinetic() in FF, Chrome, Safari, IE. Cheers, I need to get on with some other work

TimoRuetten commented 10 years ago

Nice. I will try it out and give feedback.