Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'addItems' function to Lemmon-Slider #7

merged 4 commits into from May 30, 2013


Copy link

joshuaballoch commented May 13, 2013


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.


  1. Added an 'addItem' function to lemmonSlider. Use: $('#slider').lemmonSlider('addItem',{item: '<li><div class="some-string-html-to-add">Add Me</div></li>'}) 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: '<li><div class="some-string-html-to-add">Add Me</div></li>' 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

allow lemmonSlider to accept options
add 'addItem' method that accepts an html string to append to page;
add options under addItem to prepend or append element;
support addItems for both infinite: true; and infinite: false; runtimes
sometimes, lemmonSlider cannot loop on nextPage and nextSlide because of a 1 px rounding error on nextPage and nextSlide;
lemmon added a commit that referenced this pull request May 30, 2013
Add 'addItems' function to Lemmon-Slider
@lemmon lemmon merged commit a885c6f into lemmon:master May 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.