Javascript 加载HeadJS的脚本仅在第二次单击时运行
加载HeadJS的脚本仅在第二次单击时运行。如何在第一次点击时获得鸟舍发射器Javascript 加载HeadJS的脚本仅在第二次单击时运行,javascript,aviary,Javascript,Aviary,加载HeadJS的脚本仅在第二次单击时运行。如何在第一次点击时获得鸟舍发射器 在调用launch函数之前,需要等待插件初始化。您可以使用onLoad事件: var featherEditor = new Aviary.Feather({ apiKey: 12345, apiVersion: 3, onLoad: function() { featherEdi
在调用
launch
函数之前,需要等待插件初始化。您可以使用onLoad
事件:
var featherEditor = new Aviary.Feather({
apiKey: 12345,
apiVersion: 3,
onLoad: function() {
featherEditor.launch({
image: $id,
url: $src
});
}
});
在调用
launch
函数之前,需要等待插件初始化。您可以使用onLoad
事件:
var featherEditor = new Aviary.Feather({
apiKey: 12345,
apiVersion: 3,
onLoad: function() {
featherEditor.launch({
image: $id,
url: $src
});
}
});
回答mikebridge,对于第二次无法打开的情况: 一些黑暗的原因阻止feather被多次实例化。 使用window.globalAviaryFeather保存实例
function launch(url) {
window.globalAviaryFeather.launch({
image: "imgId",
url: url
})
}
var url = "..."
if (window.globalAviaryFeather) {
launch(url)
} else {
window.globalAviaryFeather = new Aviary.Feather({
...
onLoad: function() {
self.launch(url)
}
})
}
回答mikebridge,对于第二次无法打开的情况: 一些黑暗的原因阻止feather被多次实例化。 使用window.globalAviaryFeather保存实例
function launch(url) {
window.globalAviaryFeather.launch({
image: "imgId",
url: url
})
}
var url = "..."
if (window.globalAviaryFeather) {
launch(url)
} else {
window.globalAviaryFeather = new Aviary.Feather({
...
onLoad: function() {
self.launch(url)
}
})
}
我第二次实例化鸟舍时,onLoad没有为我开火。Feather:我第二次实例化鸟舍时,onLoad没有为我开火。Feather: