lemmon/Lemmon-Slider — pull request #7 by joshuaballoch (2013-05-13 11:06:01+00:00)
Title: Add 'addItems' function to Lemmon-Slider

@lemmon

I would like to recommend adding an options to Lemmon-Slider to allow for the addition of items to a lemmon slider after it has been initialized.

Why: Applications are increasingly dynamic, for example with single page web apps. Therefore there is now a use case where pages may change on the client side without a full page refresh.

In the case of Lemmon-Slider, I have a use case where I would like to support asynchronous uploads of new images to a slideshow. In this case, I would like to parse the server response from the upload and append or prepend the new image into the slideshow shown to the user.

Changes:
1. Added an 'addItem' function to lemmonSlider. Use: ``` $('#slider').lemmonSlider('addItem',{item: '

Add Me

'})``` This method adds the new item to the slider, destroying and reinitializing the slider on either end of the append process.
2. Allow user to pass an option to prepend rather than append an item: ``` $('#slider').lemmonSlider('addItem',{item: '

Add Me

' prepend: true})```
3. Fix destroy function to remove dummy 'before' and 'after' items duplicates on slider 'destroy', to allow addItem to function with infinite sliders.

@lemmon please let me know what you think of supporting this kind of change to lemmonSlider, or if I need to make changes/improvements in order to get this merged into lemmonSlider's master branch.

Looking forward to discussing these changes with you