2032 posts
  • Has been a member for 4-5 years
  • Bought between 50 and 99 items
  • Exclusive Author
  • United States
Landonw says

Basically I have a jQuery UI range slider with 5 steps, and I want labels for each step. How would I go about this?

296 posts
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 4-5 years
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • United States
CodeFusion says

The only way I’ve been able to do that is by using spans and setting the margin-right of the span to position the “step marker”.

here; I tossed together a demo:
http://codefusionlab.com/slider_steps.html – view page source

Not saying this method is correct – I honestly don’t know – but it gets the job done and is cross browser complaint.

315 posts
  • Has been a member for 3-4 years
  • Sold between 10 000 and 50 000 dollars
  • Attended a Community Meetup
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
SyamilMJ says

You can use % instead of hard px. That way it’s more modular and can be integrated via PHP

296 posts
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 4-5 years
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • United States
CodeFusion says
For some reason, I cannot get % to scale correctly. Both sliders are using the same %s but the top slider is set to 400px wide and the bottom slider is set to 800px wide:
http://codefusionlab.com/slider_steps2.html

I recently had to use a slider with marked steps in one of my projects, and I tried several times with several variations, but the the alignment does not hold when I scale the slider. In my project I used class names with the pseudo :nth selector instead of hard coding each span – but I still had to set each and every one to a PX width and margin.

You have an example, or any guidance for using %’s? I’d love to get of the fixed widths, but I’ve not had any luck in doing so.

315 posts
  • Has been a member for 3-4 years
  • Sold between 10 000 and 50 000 dollars
  • Attended a Community Meetup
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
SyamilMJ says
296 posts
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 4-5 years
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • United States
CodeFusion says
Hayeeee! That’s clean!
http://jsfiddle.net/ejwZb/1/

Figures I was making it harder than it needed to be!

I don’t understand the borders thing though. Is its only job to push the marker down and to the left by 1 px? Sorry; I’m more of a developer than a designer.

315 posts
  • Has been a member for 3-4 years
  • Sold between 10 000 and 50 000 dollars
  • Attended a Community Meetup
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
SyamilMJ says

Yeah. Of course you can manually calculate to compensate for the borders, but that’s just messy & tedious. I found this out by accident while trying to implement the range slider for SMOF , which needed the tick marks to be auto positioned for a user-defined set of steps. :)

2032 posts
  • Has been a member for 4-5 years
  • Bought between 50 and 99 items
  • Exclusive Author
  • United States
Landonw says

Thanks guys! I had to adjust the “left” DOWN by 2% to suit the size of the labels, but it worked out well.

by
by
by
by
by
by