-
Notifications
You must be signed in to change notification settings - Fork 103
Description
I am working with slides that have names/IDs, so a couple things came to mind. When removing slides and adding them back, indexes change, so using a selector would be better. Here is a proposal:
What if your remove method could be passed a selector, or a jquery element object to remove. Like $("#infoSlide"), and if that element is a slide (a simple check of structure here perhaps, like is element.parent().parent() the main slider.) remove that slide.
That way we dont really need to know the index at which the slide is, just need to know it's ID, or just some qualifier that will select it.
Now if you do go through with this, i would request you not just take a string with the ID, let us do the selecting and pass the element as an object. Mainly because my slides have outer padding divs and other stuff around them. I would want to select using their ID.parent().etc to get the actual slide. So all you would have to do is check if the object for deletion is a slide in the current slider. The formatting inside what your slider thinks are the actual slides might change from user to user, so this allows some added flexibility.
I can add my mod storage code very easily if it is implemented this way.
Now for adding slides. If i am using a selector to remove them, i probably know which slide it was next to originally, although i may not know the index. Instead of passing an object and an index, i could pass an object (the slide to add), another object (the slide to add next to), and a boolean(selection for whether to place on the right or left.
If the slide to add next to is a slide in the current slider, just drop the new one in place. If it isn't, do nothing, maybe throw a console log in there with the error, if they tried to select something that doesn't exist they probably want to know.
Let me know what you think. I will start implementing this myself but frankly i'm not sure how to properly do it without breaking your code. Will give it a shot though.