views:

257

answers:

2

Chris from css-tricks.com created a beautiful solution for long dropdown menu's: here

I implemented this on the following page: onomadesign.com/wordpress/portfolio/identity-design, on the upper right side.

But I want this submenu to be visible all the time, so there is no need for clicking 'projects'.

Could someone help me with that? I'm definitly not a jQuery pro. Thank you.

A: 

Can you just do something like:

$(function(){
    $('#sub_menu).show();
});

At that point you may then be able to remove the anchor tag for the "projects" link. Let me know if that doesn't work for you.

EDIT:

You could also try:

$('#sub_menu').css({height:400,overflow:'hidden'}).show();

which appears to work in both FF and IE if you switch from the jQuery plugin to the regular JS file that is downloadable from the site you linked. The issue with this is that the dropdown will disappear when you mouse out of the drop down. To me, this is desirable since it's open when the user first sees the page but can be hidden by mousing over it and then mousing away. If you want it to always stay open, you can use the following code:

$('.dropdown > li').bind('mouseleave', function(event) {
    $('#sub_menu').css({height:400,overflow:'hidden'}).show();
});

which should do the trick.

Brian Hasden
thanks Brian, I tried this, but then it just shows the menu with a regular browser scrollbar, and not the cool scrolling effect.
Josh
Ok, let me give it another look.
Brian Hasden
Btw, the effect isn't working for me in FF3.5
Brian Hasden
Yes. That's because firefox doesn't display 'empty' images, so there is no need to scroll yet. But this will be fine when there are more thumbnails to display.
Josh
any other ideas? thanks very much!
Josh
Sorry, was in a meeting. I was going to update my answer to the same thing Nick said.
Brian Hasden
Thank you for your trouble. I still can't get it to work properly though, but I feel like I took too much of your time already, so I'll try to figure it out myself or something. Thanks again
Josh
+1  A: 

This probly isn't a great answer, but it works:

<script type="text/javascript" charset="utf-8">  
 $(document).ready(function() {  

  $('.dropdown > li').longDropdown({
   visible: 50
  });   
  $('.margin').live(function() {    
   $this = $(this);    
   $("body").css('marginTop', $this.attr('rel') + 'px');
   return false;
  });

            $('.dropdown a:first').click(); 

 });
</script>
Nick Spiers
Place that after the drop down is setup, and it replicates the click. It would take more time, but be worth it to go through the plugin's code and fix it to fire when the dom's ready.
Nick Spiers
Thanks, Nick. Makes sense, but where do I put this exactly? I can't seem to make it work.
Josh
stole this from your page:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('.dropdown > li').longDropdown({ visible: 50 }); $('.margin').live(function() { $this = $(this); $("body").css('marginTop', $this.attr('rel') + 'px'); return false; }); $('.dropdown a:first').click(); }); </script>
Nick Spiers
ha, didn't realize comments don't format code. Edited answer. Let me know if that works!
Nick Spiers
and that was taken from your code, around line 160
Nick Spiers
I applied the code. You can check it out, still not working. Strange because it really makes sense...
Josh
It works in IE for me, but not FF. You're just gonna hafta fool around with it from here I think.
Nick Spiers
I'm afraid that I am not capable enough to fool around but thank you very much for your trouble man. I'm on a Mac but will check on a PC later. Funny that this time it does work on IE and not the rest.
Josh