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

insertBefore & appendChild to keep listeners #4

Open
rodrigonsh opened this issue Jul 14, 2017 · 1 comment
Open

insertBefore & appendChild to keep listeners #4

rodrigonsh opened this issue Jul 14, 2017 · 1 comment

Comments

@rodrigonsh
Copy link

rodrigonsh commented Jul 14, 2017

Hi

Nice code

I've made some changes in my local copy

The first is merely cosmetic

The second allows you to add event listeners to the slider's contents

[...]

selectAllSlides = '.items section'
selectContainer = '.items'

[...]

function moveItem(

[...]

if ( position == 'afterBegin' )
{
  var refnode = element.querySelectorAll( selectAllSlides )[0]

  element.querySelector(selectContainer)
    .insertBefore(itemToMove, refnode);
}

else
{
  element.querySelector('.items')
    .appendChild( itemToMove )
 }

In order to use the carousel in my project, I've changed the markup from (ul li) to (.items section) & did the final adjustments in the carousel CSS

@zoltantothcom
Copy link
Owner

If you want to create a pull request with the code that matters - I can review and merge it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants