是否可以从 Flash 影片中打开 JQuery 灯箱?
最佳答案
尝试Calling any JS lightbox from Flash using jQuery
闪光:
import flash.external.ExternalInterface;
button.addEventListener(MouseEvent.CLICK, external, false, 0, true);
function external(evt:MouseEvent):void {
ExternalInterface.call("external", "lightbox/photos/image1.jpg");
}
Javascript:
function external(path) { // pass in the correct path to the function so we only need one <A> for infinite amount of calls from flash
// if the lightbox does not exist we will make it
if ($('a#lightbox').length == 0) {
$("body").append("</A><A id="lightbox" style="visibility: hidden; position: absolute; left: -9999px;" href="http://www.thetruetribe.com/+path+">calling js lightbox from flash</A>");
$('a#lightbox').lightBox();
// if it already exists but the path is different we will set the new path
} else if ($('a#lightbox').attr("href") != path) {
$('a#lightbox').attr("href", path);
}
// now we will simulate the click here.
$('a#lightbox').trigger("click");
}
或者你可以移植 flashLightBoxInjector Start Lightbox from Flash如果您对编写 javascript 有一定的信心,则可以轻松将 PrototypeJS 类添加到 jQuery 框架
关于jquery - 是否可以从 Flash 电影中打开 JQuery 灯箱?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1006302/