Reputation: 1059
can somebody help me with CSS. I have a list, and I want the list looks like drop down list, which is white background, have a scroll bar listing and etc.
Here my HTML code
<script>
$('document').ready(function(){
$('#textin1').click(function() {
var pos = $('#textin1').offset();
pos.top += $('#textin1').width();
$('#dropdown').fadeIn(100);
return false;
});
$('#dropdown li').click(function() {
$('#textin1').val($(this).text());
$(this).parent().fadeOut(100);
});
});
</script>
<input id="textin1" name="textin1" type="text" style="width:72px;">
<ul id="dropdown">
<?php
//display dropdown time for from
$start = strtotime('12:00am');
$end = strtotime('11:55pm');
for ($i = $start; $i <= $end; $i += 300){
$timerfrom = date('H:i', $i);
echo '<li>' . $timerfrom. '</li>' ;
}
?>
</ul>
Upvotes: 1
Views: 669
Reputation: 585
Try slideDown and slideUp functions in Jquery. http://api.jquery.com/slideDown/
Upvotes: 0
Reputation: 3269
Make sure that your list doesn't inherit unwanted styles from your css, If I'm not mistaken you want something like this: http://jsfiddle.net/h3gSe/1/
<div>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
</ul>
</div>
css:
div{
border:1px solid red;
width:100%;
height:100px;
overflow:auto;
}
ul {
margin:0px;
padding:0px;
}
ul li {
list-style:none;
display:block;
border:1px solid #2e2e2e;
background:#f9f9f9;
}
Upvotes: 1