pixxelfactory / jInvertScroll

A lightweight jQuery vertical scroll - horizontal move plugin with parallax effect.
http://www.pixxelfactory.net/jInvertScroll
MIT License
786 stars 156 forks source link

working with jQuery v1.11.1 #10

Closed yukiy closed 10 years ago

yukiy commented 10 years ago

Thanks for the nice plugins!

I used this plugin with jQuery v1.11.1 but it didn't work at first.

It seemed var scrollPercent = (currY / (totalHeight - winHeight)).toFixed(4); returns "infinity" value because totalHeight and winHeight was same value.

I changed the lines below in the plugin: $([document, window]).on('ready resize', function (e) { totalHeight = $(document).height(); winHeight = $(this).height(); winWidth = $(this).width(); }); to $([document, window]).on('ready resize', function (e) { totalHeight = $(document).height(); winHeight = $(window).height(); winWidth = $(window).width(); });

and now it works.

Was it way to go or it will lead another issue? I hope it still helps.

pixxelfactory commented 10 years ago

Hi,

thanks for your response, i guess this should work. I will however look into the issue tough, how does it come that the window width was the same value as the height? Do you still have the complete example code wich did not work? Can i take a look?

Thanks and best regards Alex Pixxelfactory

Am 02.06.14 12:17, schrieb Yuki Yoshida:

Thanks for the nice plugins!

I used this plugin with jQuery v1.11.1 but it didn't work at first.

It seemed var scrollPercent = (currY / (totalHeight - winHeight)).toFixed(4); returns "infinity" value because totalHeight and winHeight was same value.

I changed the lines below in the plugin: $([document, window]).on('ready resize', function (e) { totalHeight = $(document).height(); winHeight = $(this).height(); winWidth = $(this).width(); }); to $([document, window]).on('ready resize', function (e) { totalHeight = $(document).height(); winHeight = $(window).height(); winWidth = $(window).width(); });

and now it worked.

Was it way to go or it will lead another issue? I hope it still helps.

— Reply to this email directly or view it on GitHub https://github.com/pixxelfactory/jInvertScroll/issues/10.

yukiy commented 10 years ago

I just downloaded files from this repository and tried the example with jQuery v1.11.1 instead of v1.10.2 which comes with the example.

how does it come that the window width was the same value as the height?

Not "width" and "height" are the same. "totalHeight" and "winHeight" is the same here.

It seems $(this).height(); is the issue.

It returns different values between when I try with jQuery v1.11.1 and v1.10.2.

When I try v1.10.2, it returns a correct window height, however, in v1.11.1 it returns same value as $(document).height().

As a result, var scrollPercent = (currY / (totalHeight - winHeight)).toFixed(4); console.log(scrollPercent); returns "infinity", and makes the library not work.

After I manually changed the size of window, it starts working.

My browser is Chrome 35.0.1916.114.

Cheers, Yuki

pixxelfactory commented 10 years ago

It seems that jQuery 1.11 also gets the document height when using $(this).height()... However, i tested your solution and applied it to the repo, i also added a check if the window-height == document-height, set the scrollPercent Variable to 0 manually instead of dividing by 0. Thanks again for reporting the bug and providing a solution. I obviously mentioned you in the commit.

Cheers Alex Pixxelfactory

Am 03.06.14 11:57, schrieb Yuki Yoshida:

I just downloaded files from this repository and tried the example with jQuery v1.11.1 instead of v1.10.2 which comes with the example.

how does it come that the window width was the same value as the
height?
Not "width" and "height" are the same. "totalHeight" and
"winHeight" is the same here.

It seems $(this).height(); is the issue.

It returns different values between when I try with jQuery v1.11.1 and v1.10.2.

When I try v1.10.2, it returns a correct window height, however, in v1.11.1 it returns same value as $(document).height().

As a result, var scrollPercent = (currY / (totalHeight - winHeight)).toFixed(4); console.log(scrollPercent); returns "infinity", and makes the library not work.

After I manually changed the size of window, it starts working.

My browser is Chrome 35.0.1916.114.

Cheers, Yuki

— Reply to this email directly or view it on GitHub https://github.com/pixxelfactory/jInvertScroll/issues/10#issuecomment-44945128.

yukiy commented 10 years ago

Cool! It's nice that I can by somehow contribute a little bit for this great plugin. Thanks again too for your nice plugin! Cheers, Yuki

pixxelfactory commented 10 years ago

You're welcome =) So let's close this issue ;-)

Cheers