I have a jQuery menu that is represented with these paramaters:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#promo').pieMenu({icon : [
{
path : "/wp-content/themes/Tersus/images/piemenu/winamp.png",
alt : "Winamp",
fn : function(){('Click:: Plus');window.location.href = 'http://94.23.250.14:2199/tunein/tranceilfm.pls';return false}
}, {
path : "/wp-content/themes/Tersus/images/piemenu/vlc.png",
alt : "VLC Media Player",
fn : function(){('Click:: Plus');window.location.href = 'http://94.23.250.14:2199/tunein/tranceilfm.pls';return false}
},{
path : "/wp-content/themes/Tersus/images/piemenu/QuickTime.png",
alt : "Quick Time Player",
fn : function(){('Click:: Plus');window.location.href = 'http://94.23.250.14:2199/tunein/tranceilfm.qtl';return false}
},{
path : "/wp-content/themes/Tersus/images/piemenu/WMP.png",
alt : "Windows Media Player",
fn : function(){('Click:: Plus');window.location.href = 'http://94.23.250.14:2199/tunein/tranceilfm.asx';return false}
},{
path : "/wp-content/themes/Tersus/images/piemenu/popup.png",
alt : "נגן Popup",
fn : function(){$("#popupplay").click();return false}
},{
path : "/wp-content/themes/Tersus/images/piemenu/iTunes.png",
alt : "iTunes",
fn : function(){alert('...בקרוב');return false}
}],
beforeMenuOpen: function(){
jQuery('<div id="shadow"></div>').css(
{
'position':'fixed',
'background-color':'#000000',
'opacity': 0.6,
'width':'100%',
'height':'100%',
'z-index' :999,
'top':0,
'left':0
}).appendTo('body');
},
beforeMenuClose: function(){
jQuery('#shadow').remove();
}
});
});
</script>
That menu is operated with right click. i need to change that to hover.
The author of the plugin gave a snippet of what to insert:
$(document).ready(function(){
//init my jPie
var jPieMenu = $(#myelement').pieMenu({icon : [ {
path : "path/to/images.png",
alt : "icon",
fn : function(){alert('Click:: icon');return false;}
}] });
$('#myelement').hover(function(){
if($('#'+jPieMenu.id).css('display') != 'block') //if jpie is not visible
jPieMenu.initMenu(200,200);
})
})
Only problem is i dont know where to insert and what..i always get unexpected token.
Can someone look at my code above and suggest a place to insert it?
Thanx in advance.
First, you need to set the pie menu to a variable, so that you can reference its id:
Change:
to
Now we have a way of referencing both the menu itself and the containing element, #promo, which I assume is just a div which when is hovered over needs to set off the menu.
Anyway, add this:
between the last two sets of
})‘s and you should be good to go.Edit: and yeah, the author that gave you that code missed a quote. Shouldn’t matter, though, since you already have that part coded.