Reputation: 322
I have seen this many places. The scrolling changes value.
How to create this in html and what is this called?
Edit: People are thinking its a dropdown but that arrow moves left to right and value gets changed.
Upvotes: 0
Views: 59
Reputation: 2150
Updated example using slider
Here's an example.
var steps = [
"one",
"two",
"three",
"four",
"five"
];
$(function() {
$(".slider").slider({
value: 0,
min: 0,
max: 4,
step: 1,
slide: function(event, ui) {
$(".b").html(steps[ui.value]);
}
});
$(".b").val(steps[$(".slider").slider("value")]);
});
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800);
html,body{
font-family: 'Open Sans', sans-serif;
background-color: #fff;
text-align: center;
color: #212121;
}
h1{
text-transform: capitalize;
font-weight: 100;
font-size: 42px;
border-bottom: 1px dashed #ccc;
padding-bottom: 30px;
color: #454545;
}
.container{
max-width: 80%;
margin-left: auto;
margin-right: auto;
}
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{
background-color: #fff;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{
background: none;
}
.ui-slider-horizontal .ui-slider-handle{
top: -.5em;
}
.ui-slider-horizontal{
height: .4em;
border: 0;
background-color: #e8e8e8;
}
.b{
margin-top:20px;
font-weight: 100;
text-align: center;
display: inline-block;
background-color: #00CEAF;
color: #fff;
padding: 30px;
border-radius: 3px;
min-width: 200px;
transition: all .3s;
font-size: 20px;
&:hover{
background-color: darken(#00CEAF,5%);
}
}
height: 1.2em;
width: 1.2em;
background-color: #00CEAF ;
&:hover,&:focus,&:active{
background-color: #00CEAF;
}
}
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{border-color: #a3a3a3;}
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background-color: #a3a3a3;
outline: 0;
&:hover,&:focus,&:active{
outline: 0;
background-color: #00CEAF;
border-color: #00CEAF;
}
&:hover{
background-color: #fff;
&:active{
background-color: #00CEAF;
}
}
}
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<div class="container">
<h1>Current value is : </h1>
<div class="b">one</div>
<div class="slider"></div>
Upvotes: 1
Reputation: 223
You can't do this with HTML.
If you want to use a form for option select with HTML you can do something like this:
<select>
<option value="1">One</option>
<option value="2">Two</option>
</select>
To design the form with the colors and shapes you like you can use CSS. You can also use some dropdown plugin.
Upvotes: 0