jquery dropdown list

By Korvin on Mar 11, 2010

A much nicer version of my dropdown script, styled version can be seen at http://left4quake.com/maupin for a limited period of time as it is an assignment.
minimum css:

.item {height:0px;}
.drop {float:left;}

minimal setup:

<script src='jquery.js'></script>
<style>.item {height:0px;}.drop {float:left;}</style>
<div class='drop'>List 1<b class='item'>Item 1</b><b class='item'>Item 2</b></div>
<script>
$('.item').hide();
$('.drop').hover(function(){jQuery('.item',this).animate({'height':'20px','opacity':1},200);},function() {jQuery('.item',this).animate({'height':'0px','opacity':0},200);});
</script>

it is crucial that you include the newest version of jquery at the beginning of your file, and have this code after the drop lists are stated.

$('.item').hide();
$('.drop').hover(function(){
    jQuery('.item',this).animate({'height':'20px','opacity':1},200);
},
function(){
    jQuery('.item',this).animate({'height':'0px','opacity':0},200);
});

Comments

Sign in to comment.
Hawkee   -  Mar 11, 2010

Ahh, thanks for catching that. It's been fixed.

 Respond  
Korvin   -  Mar 11, 2010
Warning: Invalid argument supplied for foreach() in /home/hawkee/public_html/post_snippet.php on line 162

Warning: Cannot modify header information - headers already sent by (output started at /home/hawkee/public_html/post_snippet.php:162) in /home/hawkee/public_html/post_snippet.php on line 180

Warning: Cannot modify header information - headers already sent by (output started at /home/hawkee/public_html/post_snippet.php:162) in /home/hawkee/public_html/phpBB2/includes/page_header.php on line 503

Warning: Cannot modify header information - headers already sent by (output started at /home/hawkee/public_html/post_snippet.php:162) in /home/hawkee/public_html/phpBB2/includes/page_header.php on line 509

Warning: Cannot modify header information - headers already sent by (output started at /home/hawkee/public_html/post_snippet.php:162) in /home/hawkee/public_html/phpBB2/includes/page_header.php on line 510

going to bed gn.

 Respond  
Korvin   -  Mar 11, 2010

edit>edited>save>php error with header.php>upload screenshot>saved as new snippet.

 Respond  
Hawkee   -  Mar 11, 2010

You can save without a screenshot, that shouldn't be a problem. So can you explain the steps you took for the duplicate post to manifest?

 Respond  
Korvin   -  Mar 11, 2010

there is no prob with screenshot, was a random image

 Respond  
Korvin   -  Mar 11, 2010

wasn't meant to be a new post, didn't let me edit and save. couldn't save without a screenie, so uploading one, which wasn't saved and apparently caused it to be a whole new snippet.

 Respond  
Hawkee   -  Mar 11, 2010

There seems to be a problem with the screenshot. Can you give me a link to the original so I can investigate why it's showing up incorrectly.

 Respond  
Korvin   -  Mar 11, 2010

updated

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.