jsor / jcarousel

Riding carousels with jQuery.
https://sorgalla.com/jcarousel/
MIT License
1.99k stars 734 forks source link

JS error in Console: Unable to get property 'left' of undefined or null reference only IE but not in FF or Chrome #781

Closed deyan-enchev closed 8 years ago

deyan-enchev commented 8 years ago

The error will appear based on the following:

If not page is post back, zooming in and out of the browser or resizing the browser's window does not produce the error. But after a post back (be it from a button click event or what so), zooming in and out of the browser or resizing the browser's window will produce the error.

This problem only occurs in IE, but not in FF or Chrome.

Steps to reproduce:

  1. Reload a page the contains the carousel
  2. Resize the page in IE

The issue is straight forward to replicate.

2015-11-18_1046

jsor commented 8 years ago

Can you setup a reproducible test case somewhere (ie. on jsfiddle)?

deyan-enchev commented 8 years ago

I am afraid that a reproduction cannot be made in isolated environment such as: https://jsfiddle.net/vdvo0j2L/

Surely the problem is more deep than simply putting a jcarousel on a page. The issue itself can be seen after POST request is executed on page opened in IE that contains the jcarousel.

Best, Deyan

jsor commented 8 years ago

It's hard to say without actually seeing the code. I supect that the element you assigned the carousel to is removed from the DOM and/or maybe replace by another element. So, jCarousel loses the reference to the actual DOM element.

var element = $('.jcarousel').jcarousel();

I guess that after the POST request the DOM element store in element isn't anymore in the DOM.