Controlling the Vertical Scrollbar of a Select/Combo Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RamananKalirajan
    Contributor
    • Mar 2008
    • 608

    Controlling the Vertical Scrollbar of a Select/Combo Box

    Hi All,
    I have this question for a long time. I googled out but no use. I want to have my vertical scrollbar shown after my 5 options are shown. I dont want to use multipe or size. Since it makes the select as a list box. Any Solutions or suggestions would be helpful...

    Thanks and Regards
    Ramanan Kalirajan
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I want to have my vertical scrollbar shown after my 5 options are shown.
    how do I have to understand that?

    Comment

    • RamananKalirajan
      Contributor
      • Mar 2008
      • 608

      #3
      Suppose I have a select with 100 option, when i click the drop image over there, only 5 options should be viewable for me, to view the rest i have to scroll. But the default scrollbar cant be controlled. This is my problem

      Thanks and Regards
      Ramanan Kalirajan

      Comment

      • larztheloser
        New Member
        • Jan 2010
        • 86

        #4
        In that scenario, why don't you just adjust the contents of the select?

        Comment

        • RamananKalirajan
          Contributor
          • Mar 2008
          • 608

          #5
          laztheloser,
          Can you elaborate your point?

          Thanks and Regards
          Ramanan Kalirajan

          Comment

          • larztheloser
            New Member
            • Jan 2010
            • 86

            #6
            When your image is clicked, you could recreate all the options of your select. Put the 5 you want at the top, and make sure the top one is selected. Then pad the select box with some empty options, then add in the rest. The advantage of using this method is that it's still an HTML box and it's really easy - you're just modifying the innerHTML of a select box, after all! The disadvantages are that 1)Different browsers have different scroll-bar thresh-holds, but the distinction should still be clear to the user, and 2)depending on how many hundreds of options you have it could be quite slow. You could get around this by pre-generating the code for the options when the image is clicked.

            Or you could just use a script to simulate a select, of course! You'll find several if you google for them, but the basic idea is to have a popup scrollable div layer underneath your "field".

            Comment

            Working...