【问题标题】:thickbox not load the embed tag content厚盒不加载嵌入标签内容
【发布时间】:2009-05-29 04:30:42
【问题描述】:

我需要一些关于厚盒的建议,拜托! 我只是按照thickbox inline 中的示例进行操作,但无法根据需要在页面中加载div 的内容。我的html代码和jquery代码就是这样。对我的问题有什么建议吗?

 $(".artist").hover(function(){
        var artistname = $(this).attr("title");
        var artist = "<embed hspace=\"5\" vspace=\"5\" ";
        artist += "src=\"http://abc.vn/res/music/passion/MP3_Player.swf\"";
        artist += "menu=\"false\" quality=\"high\" width=\"330\" height=\"338\"";
        artist += "name=\"index\" allowScriptAccess=\"never\" type=\"";
        artist += "application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"";
        artist +=   "flashvars=\"&amp;config=http://abc.vn/res/music/passion/MP3_Config.xml&amp;";
        artist += "file=http://abc.vn/listsong.hightway?artist=" +artistname+ "\"";
        artist += "wmode=\"transparent\" border=\"0\"></embed>";

        $("#tooltip_artist").replaceWith(artist);
        $("#tooltip_artist").css({display:"none"});
    },function(){});

<a class="artist" title="singer's name" rel="#TB_inline&inlineId=tooltip_artist" href="/singer's name">singer's name</a>

感谢您的关注!

【问题讨论】:

  • 非常感谢弗朗茨!正如你所说,我将替换为 html() 。现在我有两个问题,我无法回答,所以我希望你能再次帮助我!第一次我使用qtip或thickbox或类似插件的东西,但我的问题是我想从包含qtip或thickbox的页面内的div中显示内容,而不像他们的示例从html文件中获取动态内容。我浪费了三个小时,真的很绝望,你能给我一些建议吗?第二个是嵌入标签总是在出现thickbox之后显示,我也无法修复它。

标签: jquery thickbox


【解决方案1】:

首先在这里使用replaceWith 是不明智的,因为在第一次悬停后,$('tooltip_artist') 节点将被替换为您的swf --> 后续悬停将不起作用。最好使用 .html() 方法将嵌入代码插入到 $('tooltip_artist') 中。

然后我会为 html sn-p 使用双/单引号,这样您就不必一直转义属性引号

var artist = '<embed hspace="5" vspace="5">';

最后,您确定要在此处使用 .hover 吗?显然,您的意图是在用户将鼠标悬停在他的名字上时播放艺术家的音乐。

但在这种情况下,您的方法是错误的。您最好在页面某处嵌入一个可编写脚本的 mp3 播放器,并在用户将鼠标悬停在曲目名称上时触发其播放方法。与总是在 .hover 上重新实例化 swf 电影相比,这提供了更好的性能。有一个不错的 jPlayer jQuery 插件(完全可通过 CSS 设置样式),你应该看看。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-08
    • 1970-01-01
    相关资源
    最近更新 更多