SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    425
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Display drop shadow question

    I have a basic CSS menu, that has submenus. I am wanting to add a drop shadow to the drop down boxes, using jQuery.
    I have found a nifty jQuery plugin that does shadows:
    http://dl.dropbox.com/u/1546882/jquery.dropshadow.js

    Only problem is, the drop down shadow displays whether or not the submenu is showing/visible.

    The menu structure is rather simple with UL and LI:
    <ul class="submenu submenu-1">
    <li class="item item-1"><a href="http://www.mysite.com/page1">Page 1</a></li>
    <li class="item item-2"><a href=http://www.mysite.com/page2">Page 2</a></li>
    </ul>

    There is only currently 1 submenu, but I will probably be adding more (with the same parent, not sub-sub menus).

    How can I, with jquery, make the dropshadow display only when these submenus (UL) are visibility:visible, and not all the time (like currently)?

    Drop shadow syntax:
    Code JavaScript:
    jQuery(selector).dropShadow(options);  // Creates new drop shadows
    jQuery(selector).redrawShadow();       // Redraws shadows on elements
    jQuery(selector).removeShadow();       // Removes shadows from elements
    jQuery(selector).shadowId();           // Returns an existing shadow's ID

    Many thanks.

  2. #2
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    425
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something like the following doesn't seem to work, still displays 100&#37; of the time (even if visibility:hidden):
    Code JavaScript:
    jQuery("ul.submenu:not(:visible)").removeShadow();
    jQuery("ul.submenu:visible").dropShadow();
    and
    Code JavaScript:
    jQuery("ul.submenu:not(:hidden)").dropShadow();
    jQuery("ul.submenu:hidden").removeShadow();
    Also I am not sure if this would work if there was more than 1 submenu?!?

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    425
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any ideas?

  4. #4
    SitePoint Evangelist
    Join Date
    Jan 2005
    Posts
    425
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tried some other things, and still no luck.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •