0

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.

TM.
  • 108,298
  • 33
  • 122
  • 127
Josh
  • 33
  • 1
  • 7
  • shit sorry, it's this one http://onomadesign.com/wordpress/portfolio/identity-design/ – Josh Nov 24 '09 at 18:34
  • update the question, so other can see it as well :) – yoda Nov 24 '09 at 18:35
  • Its not the answer, but i should add that this "solution" actually doesn't solve the trouble, it just fixes the height of menu and scrolls it, nothing more. The actual solution should allow menu depth and should be generic, like this - https://jsfiddle.net/lucifer63/bzrt3ps7/ – lucifer63 Oct 03 '16 at 13:53

2 Answers2

1

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
  • 2,344
  • 2
  • 19
  • 31
  • 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 Nov 24 '09 at 19:00
  • Thanks, Nick. Makes sense, but where do I put this exactly? I can't seem to make it work. – Josh Nov 24 '09 at 19:06
  • stole this from your page: – Nick Spiers Nov 24 '09 at 19:10
  • ha, didn't realize comments don't format code. Edited answer. Let me know if that works! – Nick Spiers Nov 24 '09 at 19:12
  • I applied the code. You can check it out, still not working. Strange because it really makes sense... – Josh Nov 24 '09 at 19:15
  • It works in IE for me, but not FF. You're just gonna hafta fool around with it from here I think. – Nick Spiers Nov 24 '09 at 19:34
  • 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 Nov 24 '09 at 19:47
0

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
  • 4,050
  • 2
  • 31
  • 37
  • thanks Brian, I tried this, but then it just shows the menu with a regular browser scrollbar, and not the cool scrolling effect. – Josh Nov 24 '09 at 18:51
  • Ok, let me give it another look. – Brian Hasden Nov 24 '09 at 18:54
  • 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 Nov 24 '09 at 19:02
  • Sorry, was in a meeting. I was going to update my answer to the same thing Nick said. – Brian Hasden Nov 24 '09 at 20:26
  • 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 Nov 24 '09 at 22:52