Open christian-seifert opened 10 years ago
Hi Christian!
Thanks for sharing this problem, and your solution code!
With only a cursory look, the change looks good. If you are willing to fork the repo, add your changes, and maybe even include a demo, then submit a pull request, it would make integration a whole bunch easier :)
Thanks again! Rob
Hi, I made a quick fiddle to show how the changes work here: http://jsfiddle.net/2hhUE/16/ I tested it with Chrome and FF. Have a look please. if everything is okay, I will submit a pull request later today
It looks good to me :)
And I meant, add a demo to the repo, if you are willing :)
Thanks again!
Hi There! I couldn't find any thread regarding this issue and I couldn't find a solution so I came up with my own. I am not sure if this is the best and most simple solution but if anyone find themselfe with the same problem I hope this helps.
So the problem is/was: I wanted to add video to an (already initialized) AnythingSlider + Video extension containing only videos (pure video slider). After every video add I had to update the slider and the extension which caused the extension to re-initalize every already initialized video. I was unable to slide through my videos because the list-indexes were also updated. Example: I added 1 Video -> this got the id asvideo0 which is correct. Then I added another video. This resulted in the following: 2 videos. 1st had the id asvideo1 and index 1 and the 2nd had the id asvideo2 and index 2, which is not correct!
Solution:
Code changes:
This prevents overwirting of base.video with an empty object if there already is a base.video
Adding a new object-key to the video which indicates if the video was already initialized Plus adding a new data attribut to the iframe container which indicates the same
Preventing 'reinitialisation'
Preventing 'reinitialisation' of iframe
Marking Video as initialized
Thats already it. I tested it a couple of times in FF. Adding and Removing Videos to the Slider works for me. They don't get initialized twice and sliding through works fine. I am not sure, if this is the best practice/code and if it works for all of you - I just needed a quick fix.
It would be nice, if some could review these changes and post their opinion. Maybe this 'feature' finds its way in a future update - would be nice.
Thanks Christian