厚盒不加载嵌入标签内容

发布于 2024-07-21 22:21:37 字数 1167 浏览 4 评论 0原文

我需要一些关于厚盒的建议,拜托! 我只是按照厚盒内联中的示例进行操作,但无法按照我想要的方式在页面中加载 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>

感谢您的关注!

I need some advice about thickbox, please!
I've just follow the example in thickbox inline but I couldn't load the content of the div in my page as I wanna. My html code and jquery code like that. Any suggestion for my problem?

 $(".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=\"&config=http://abc.vn/res/music/passion/MP3_Config.xml&";
        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>

Thank you for your attention!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-07-28 22:21:37

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

然后我会在 html 片段中使用双/单引号,这样您就不必一直转义属性引号

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

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

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

First of all it's not wise to use replaceWith here, because after the first hovering, the $('tooltip_artist') node will be replaced with your swf --> subsequent hoverings won't work. Its better to insert the embed code into the $('tooltip_artist') by using the .html() method.

then I'd use double/single quotes for the html snippet, so that you don't have to escape the attribute quotes all the time

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

Finally, are you sure you want to use .hover here? Obviously your intention is to play the music of an artist while the user is hovering over his name.

But in this case your approach is wrong. You'd better embed a scriptable mp3 player somewhere on the page and trigger its play method when the user is hovering over a track name. This gives a much better performace compared to always reinstantiating a swf Movie on .hover There is the nice jPlayer plugin for jQuery (completely styleable by CSS), you should have a look at that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文