bxslider-4 icon indicating copy to clipboard operation
bxslider-4 copied to clipboard

[bug] Slider runs into undefined state when reloadSlider is called before initialization was finished

Open ppowalowski opened this issue 9 years ago • 7 comments

I am almost afraid to add an issue to this utterly big issue list. Are all open issues still valid?

The slider is trapped in an undefined state when using reloadSlider() before initialization actually finished. Internal variable slider.initialized is still undefined (because asynchronously waiting for images to be loaded from original loading) so destroySlider() inside reloadSlider() returns too early without doing it's job to unset all necessary variables. Obviously this can be quickfixed ignoring slider.initialized inside destroySlider()- but I didn't analyze this for sideffects yet.

for easier comprehension check out https://github.com/stevenwanderski/bxslider-4/blob/master/src/js/jquery.bxslider.js#L1533 and https://github.com/stevenwanderski/bxslider-4/blob/master/src/js/jquery.bxslider.js#L123

These lines exclude each other inside of the mentioned trap.

ppowalowski avatar Jun 05 '15 20:06 ppowalowski

Short answer is no - not all issues are valid still.

I was added to this project after it sat for a long time unmaintained. I've tried to keep up, clean up, and maintain the best I can while dealing with full time work. Most issues are actually either old, general questions that aren't issues / bugs, or have been resolved just not cleaned up.

You've proven to know your stuff and use the issue system for what it's meant to do, so please continue to report.

I'm in currently stepping into an interview for a new hire but will look at this asap.

Thanks.

Tidal-Wave avatar Jun 05 '15 21:06 Tidal-Wave

I actually use bxSlider quite heavily (with lot's of api and callback usage) in a present project so i ran in several issues. I'll continue working on this.

I'll keep up contributing.

ppowalowski avatar Jun 07 '15 13:06 ppowalowski

Hi,

I know it's an old issue, but I'm currently running into that same problem. Big user of bxSlider for several years, it's the first time I'm facing this.

Have you found a way to avoid it ?

oilvier avatar Jan 18 '17 20:01 oilvier

Hi,

I am not in the topic so much currently but rereading my issue description removing this line should do the job: https://github.com/stevenwanderski/bxslider-4/blob/master/src/js/jquery.bxslider.js#L1558

In the end I used a modified version which besides fixing this was also containing several further tweaks. It can be found here: https://github.com/ppowalowski/bxslider-4/tree/dev

ppowalowski avatar Jan 31 '17 21:01 ppowalowski

Thank you, I'll try and look your version out !

oilvier avatar Feb 05 '17 18:02 oilvier

I am trying to navigate to the first slide on a button click (#first), but i am getting error as "Uncaught TypeError: Cannot read property 'goToSlide' of undefined". Below is my code: $('#first').click(function () { slider = $('.bxslider').bxSlider(); alert(slider); slider.goToSlide(0); return false; });

this is my full code in which i am using bxslider: My Code.txt

Danish8321 avatar Apr 19 '17 10:04 Danish8321

I am trying to navigate to the first slide on a button click (#first), but i am getting error as "Uncaught TypeError: Cannot read property 'goToSlide' of undefined". Below is my code: $('#first').click(function () { slider = $('.bxslider').bxSlider(); alert(slider); slider.goToSlide(0); return false; });

this is my full code in which i am using bxslider: My Code.txt

slider is not defined. Add "var" before slider = $('.bxslider')....

Warface avatar Sep 18 '19 15:09 Warface