Monday, July 25, 2011

Filament Group iPod Drill-Down Menu As a Context Menu

Filament Group has an awesome menu but I needed it to work as a context menu (right clicking will bring up the menu.) If you need to do that too, just replace the following in the Javascript file (Note, I've just commented out the original and put the new code in under it):


$.fn.menu = function(options){
var caller = this;
var options = options;
var m = new Menu(caller, options);
allUIMenus.push(m);


/*$(this)
.mousedown(function(){
if (!m.menuOpen) { m.showLoading(); };
})
.click(function(){
if (m.menuOpen == false) { m.showMenu(); }
else { m.kill(); };
return false;
}); */

/*New code for context menu*/
$(this)
.bind('contextmenu',function(e){
if (m.menuOpen == false) { m.showMenu(); }
else { m.kill(); };
return false;
});
};


 

Enjoy!

 

Here's the menu from Filament Group: http://www.filamentgroup.com/examples/menus/ipod.php