SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Looking for Tutorial for Similer JavaScript Effect

    Hi,

    I've come across this site and love the navigation styling where you can hover over a link then take the arrow across to another menu.

    I'm after a similer effect for a site design but not sure what i should be searching for or of a site which will have good resources for tutiorals like this.

    Any advice?

    Thanks

    http://www.cpd.uhi.ac.uk/cpd/home

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    First of all, I'd recommend you having a look at it with JavaScript disabled. Not so nice! It ought to degrade nicely when JavaScript is unavailable. Even if it means not having those extra ones there at all, or (preferable) lower down in the page, with IDs that can be targeted.

    Still, the JavaScript is very simple. All it is is using onmouseover events to toggle between display:none and display:block. Then each of the coloured speech bubbles is given a different class name and is styled accordingly with CSS, using background images for the speech bubbles. This code (uses jQuery) is what does it:
    Code JavaScript:
    function homepagePrepare() {    
        // Collect all the widget details displays, and hide them
        widgetDetails = $('#widgetDetails div.blurb').hide();
        // Just show the first one
        $(widgetDetails[0]).show();
     
        // Collect all the triggers, and attach an event to each one with the corresponding detail display
        widgetTriggers = $('#homepageSectorWidget li a');
        widgetTriggers.each( function(i) {
                  $(this).hover( function() {
                           widgetDetails.hide();
                           widgetTriggers.removeClass('active');
                           $(widgetDetails[i]).show();
                           $(this).addClass('active');
                    },
                     function(i) {
                          //$(this).removeClass('active');
                     });
        });
        // Highlight the first trigger
        $(widgetTriggers[0]).addClass('active');
    }


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
  •