This repository was archived by the owner on Apr 17, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathdropbox.html
More file actions
141 lines (130 loc) · 3.06 KB
/
Copy pathdropbox.html
File metadata and controls
141 lines (130 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<style>
* {
outline: 0;
font-family: sans-serif
}
body {
background-color: #fafafa
}
span.msg,
span.choose {
color: #555;
padding: 5px 0 10px;
display: inherit
}
.container {
width: 500px;
margin: 50px auto 0;
text-align: center
}
/*Styling Selectbox*/
.dropdown {
width: 300px;
display: inline-block;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 0 2px rgb(204, 204, 204);
transition: all .5s ease;
position: relative;
font-size: 14px;
color: #474747;
height: 100%;
text-align: left
}
.dropdown .select {
cursor: pointer;
display: block;
padding: 10px
}
.dropdown .select > i {
font-size: 13px;
color: #888;
cursor: pointer;
transition: all .3s ease-in-out;
float: right;
line-height: 20px
}
.dropdown:hover {
box-shadow: 0 0 4px rgb(204, 204, 204)
}
.dropdown:active {
background-color: #f8f8f8
}
.dropdown.active:hover,
.dropdown.active {
box-shadow: 0 0 4px rgb(204, 204, 204);
border-radius: 2px 2px 0 0;
background-color: #f8f8f8
}
.dropdown.active .select > i {
transform: rotate(-90deg)
}
.dropdown .dropdown-menu {
position: absolute;
background-color: #fff;
width: 100%;
left: 0;
margin-top: 1px;
box-shadow: 0 1px 2px rgb(204, 204, 204);
border-radius: 0 1px 2px 2px;
overflow: hidden;
display: none;
max-height: 144px;
overflow-y: auto;
z-index: 9
}
.dropdown .dropdown-menu li {
padding: 10px;
transition: all .2s ease-in-out;
cursor: pointer
}
.dropdown .dropdown-menu {
padding: 0;
list-style: none
}
.dropdown .dropdown-menu li:hover {
background-color: #f2f2f2
}
.dropdown .dropdown-menu li:active {
background-color: #e2e2e2
}
</style>
<html>
<div class="container">
<span class="choose">Choose Gender</span>
<div class="dropdown">
<div class="select">
<span>Select Gender</span>
<i class="fa fa-chevron-left"></i>
</div>
<input type="hidden" name="gender">
<ul class="dropdown-menu">
<li id="male">Male</li>
<li id="female">Female</li>
</ul>
</div>
<span class="msg"></span>
</div>
</html>
<script>
/*Dropdown Menu*/
$('.dropdown').click(function () {
$(this).attr('tabindex', 1).focus();
$(this).toggleClass('active');
$(this).find('.dropdown-menu').slideToggle(300);
});
$('.dropdown').focusout(function () {
$(this).removeClass('active');
$(this).find('.dropdown-menu').slideUp(300);
});
$('.dropdown .dropdown-menu li').click(function () {
$(this).parents('.dropdown').find('span').text($(this).text());
$(this).parents('.dropdown').find('input').attr('value', $(this).attr('id'));
});
/*End Dropdown Menu*/
$('.dropdown-menu li').click(function () {
var input = '<strong>' + $(this).parents('.dropdown').find('input').val() + '</strong>',
msg = '<span class="msg">Hidden input value: ';
$('.msg').html(msg + input + '</span>');
});
</script>