将div插入jQuery菜单

时间:2012-08-01 12:38:01

标签: javascript jquery html jquery-plugins

我有一个看起来像这样的jQuery菜单插件

<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(){('Click:: Plus');window.location.href = 'http://www.tranceil.fm/wp-content/plugins/fullwidth-audio-player/popup.html';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> 

如何将标题中的div插入其中一个图标?我希望其中一个图标调用该div(它是一个音频播放器按钮,用于打开播放器的弹出窗口)

<div class="fap-track-buttons"><a href="http://94.23.250.14:8000/live" title="TranceIL.FM" rel="http://www.tranceil.fm/wp-content/uploads/2012/05/logo-tranceil-1024x5761.png" target="" data-meta="#fap-meta-3227" class="fap-play-button fap-single-track">Play</a>
                </div>

您可以查看http://www.tranceil.fm/,然后按中间的“播放”按钮查看。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

根据您的data-meta元属性的作用,您可以将其添加到菜单中:

,{ 
  path : "/wp-content/uploads/2012/05/logo-tranceil-1024x5761.png",
  alt  : "Play",
  fn   : function(){window.location.href = 'http://94.23.250.14:8000/live';return false}

如果没有,你肯定可以这样做:

,{ 
  path : "/wp-content/uploads/2012/05/logo-tranceil-1024x5761.png",
  alt  : "Play",
  fn   : function(){$("#yourID").click();return false}

然后你只需要将id= "yourID"添加到播放按钮(不是div,<a>元素)