我有一个非常基本的文件,我在Edge Animate中创建,其中我只是淡化和淡出一些文本。它位于:
http://www.threecell.com/demo/simpletext/simpletext.html
Edge Animate导出HTML文件和一些JS文件。我的问题是,是否可以使用它以便您以后可以使用WordPress框架更新文本。我发现实际文本是在我下面发布的一个JS文件中声明的(有问题的文字是"这是测试"。)最后,我想要创建一个WordPress小部件,该小部件进入此JS文件并更改文本值。
提前感谢您的任何帮助或指导,
/**
* Adobe Edge: symbol definitions
*/
(function($, Edge, compId){
//images folder
var im='images/';
var fonts = {};
var resources = [
];
var symbols = {
"stage": {
version: "2.0.1",
minimumCompatibleVersion: "2.0.0",
build: "2.0.1.268",
baseState: "Base State",
initialState: "Base State",
gpuAccelerate: false,
resizeInstances: false,
content: {
dom: [
{
id:'Text',
type:'text',
rect:['131','190','auto','auto','auto','auto'],
text:"THIS IS A TEST",
font:['Arial, Helvetica, sans-serif',24,"rgba(0,0,0,1)","normal","none",""]
}],
symbolInstances: [
]
},
states: {
"Base State": {
"${_Stage}": [
["color", "background-color", 'rgba(255,255,255,1)'],
["style", "overflow", 'hidden'],
["style", "height", '400px'],
["style", "width", '550px']
],
"${_Text}": [
["style", "top", '200px'],
["style", "opacity", '0'],
["style", "left", '197px']
]
}
},
timelines: {
"Default Timeline": {
fromState: "Base State",
toState: "",
duration: 1500,
autoPlay: true,
timeline: [
{ id: "eid7", tween: [ "style", "${_Text}", "opacity", '1', { fromValue: '0'}], position: 0, duration: 1500 },
{ id: "eid4", tween: [ "style", "${_Text}", "left", '297px', { fromValue: '197px'}], position: 0, duration: 1500 },
{ id: "eid5", tween: [ "style", "${_Text}", "top", '193px', { fromValue: '200px'}], position: 0, duration: 1500 } ]
}
}
}
};
Edge.registerCompositionDefn(compId, symbols, fonts, resources);
/**
* Adobe Edge DOM Ready Event Handler
*/
$(window).ready(function() {
Edge.launchComposition(compId);
});
})(jQuery, AdobeEdge, "EDGE-2538351");
答案 0 :(得分:1)
您必须create a plugin并使用Widgets_API。
在前端,小部件将使用wp_enqueue_script
加载simpletext_edgePreload.js
。然后使用wp_localize_script
将文本值作为JavaScript数据传递。
您最终可以在JS文件中使用类似的内容:text:my_data.text
。
短代码示例:Wordpress Javascript File SRC File Path。
小部件示例:Conditionally enqueue a widget's script/stylesheet in HEAD