0

I want a vertical slider on my site, I am using ruby 4.0 and I can use

<%= f.range_field :value, :min => 0, :max => 250 %>

to display what I want, but I want this bar to be vertical and not horizontal (default?), anyways I tried, of course to google the answer but didn't find a clue about how to achieve this, I went to API documentation at api.rubyonrails.org and all I found was "Accepts same options as range_field_tag" but then I didn't find range_field_tag anywhere, I wonder if I will have to implement a third party solution to this... if so, do you recommend any gem or jquery like library?

thanks in advance!

Wiston Coronell
  • 3,087
  • 3
  • 20
  • 27

2 Answers2

0

There is no standard way of doing this and that's why rails does not provide any option for it. You will have to dig into some css to achieve it.

Here is a related SO question Google chrome vertical <input type="range" />

Community
  • 1
  • 1
Ismael Abreu
  • 16,443
  • 6
  • 61
  • 75
0

Replace custom_id with the id generated for the range field and in your css add the below code

#custom_id {
    -webkit-appearance: slider-vertical;
}

For eg: Assuming that value is your field name, then id generated would be modelname_value

Kirti Thorat
  • 52,578
  • 9
  • 101
  • 108
  • Close enough, but this works only for chrome, similar code for mozilla doesn't work, neither for IE, will keep looking for an answer, thanks though :D – Wiston Coronell Feb 28 '14 at 23:23