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

Feature request: Built-in position indicator #48

Closed
drale2k opened this issue Mar 25, 2012 · 1 comment
Closed

Feature request: Built-in position indicator #48

drale2k opened this issue Mar 25, 2012 · 1 comment

Comments

@drale2k
Copy link

drale2k commented Mar 25, 2012

I just saw the Swipe2 branch and noticed that this feature is still not there so i'd like to ask if you have any plans to implement a position indicator feature?

I know it is not hard to do it manually with a little bit JS and html but it would be much more elegant to have it built in with an option like 'indicator: true' or something.

What i am doing right now achive this is something like

slider_li_el.each (index) =>
  slider_position_el.append("<li data-position='#{index}'>V</li>")

I have a

    where the above generates li's get appended to. You see this requires some JS and some HTML which i'd love not have to write. Especially when you have multiple sliders.

@ibrent
Copy link

ibrent commented Mar 26, 2012

With Swipe 2 - I couldn't get the pos value - so I've had to use the slider.index like this. It may help you:

$(document).ready(function(){ 
        // slider init
        window.slider = new Swipe(document.getElementById('slider'), {
          speed: 600,
          continuous: true,
                  callback: function(e, pos) {   
                    var si = slider.index;
                    var i = bullets.length;
                    while (i--) {
                      bullets[i].className = ' ';
                    }
                  bullets[si].className = 'on';
                  }
              }),
              bullets = document.getElementById('bulletPosition').getElementsByTagName('em');
          // button events
          $("#prev").on("click", function(){slider.prev();return false;});
          $("#next").on("click", function(){slider.next();return false;});
    });

@thebird thebird closed this as completed Mar 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants