SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot samg914's Avatar
    Join Date
    Nov 2009
    Location
    Boston, MA
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Sliding jQuery Navigation

    Is it possible to make a sliding navigation menu with a dropdown list. Here is an example of the menu I am referring to: http://www.branded07.com/

    Thanks,

    Sam

  2. #2
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the script they use for their slider:
    Code JavaScript:
    var SlideList = new Class({
    initialize: function(menu, options) {
    this.setOptions(this.getOptions(), options);
     
    this.menu = $(menu), this.current = this.menu.getElement('li.current');
     
    this.menu.getElements('li').each(function(item){
    item.addEvent('mouseover', function(){ this.moveBg(item); }.bind(this));
    item.addEvent('mouseout', function(){ this.moveBg(this.current); }.bind(this));
    item.addEvent('click', function(event){ this.clickItem(event, item); }.bind(this));
    }.bind(this));
     
    this.back = new Element('li').addClass('background').adopt(new Element('div').addClass('left')).injectInside(this.menu);
    this.back.fx = this.back.effects(this.options);
    if(this.current) this.setCurrent(this.current);
    },
     
    setCurrent: function(el, effect){
    this.back.setStyles({left: (el.offsetLeft)+'px', width: (el.offsetWidth)+'px'});
    (effect) ? this.back.effect('opacity').set(0).start(1) : this.back.setOpacity(1);
    this.current = el;
    },
     
    getOptions: function(){
    return {
    transition: Fx.Transitions.sineInOut,
    duration: 500, wait: false,
    onClick: Class.empty
    };
    },
     
    clickItem: function(event, item) {
    if(!this.current) this.setCurrent(item, true);
    this.current = item;
    this.options.onClick(new Event(event), item);
    },
     
    moveBg: function(to) {
    if(!this.current) return;
    this.back.fx.custom({
    left: [this.back.offsetLeft, to.offsetLeft],
    width: [this.back.offsetWidth, to.offsetWidth]
    });
    }
    });
     
    SlideList.implement(new Options);

    Have you tried to add this to your dropdown list already?

  3. #3
    SitePoint Zealot samg914's Avatar
    Join Date
    Nov 2009
    Location
    Boston, MA
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bulevardi,

    I haven't even created a sliding navigation yet because I want to be sure that I can add a drop down menu to it first.


Tags for this Thread

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
  •