How to add two same adobe edge animation in single html page?

醉酒当歌 提交于 2020-01-01 03:39:08

问题


I am using jquery mobile where different pages contents will be in one html page.

On page change(sliding page), other pages have same edge animates, because of all html contents will be located in single html page, only first edge animate will work, rest will not work.

I have two stage id's

<div id="Stage" class="spring_animation"></div>

<div id="Stage2" class="spring_animation"></div>

Below code used for one stage(<div id="Stage") edge animate to work...

<!--Adobe Edge Runtime-->
<script type="text/javascript" charset="utf-8" src="spring_edgePreload.js"></script>
<!--Adobe Edge Runtime End-->

<script type="text/javascript">
 jQuery(document).ready(function(){        
     jQuery('[data-url="10.htm"]').live('pageshow', function(){

        if($ && $.Edge && $.Edge.symbol.get($("#Stage"))){
            $('#Stage, #Stage > div').show();
            $.Edge.symbol.get($("#Stage")).play(0); 
        }

    });   
 });       
</script>

But, it doesn't works.

Will anyone in community please help me solve this issue?

I think, problem is relies with adobe edge animate and its API.


回答1:


I followed this tutorial and it works. http://blogs.adobe.com/edge/2012/05/15/bootstrapping-edge-compositions/

It uses plain javascript to show/hide the right composition. All the magic is beacause of the callback: AdobeEdge.bootstrapCallback(function (compId) { //your function will be called when the composition is ready to play });

As stated in the comment this callback will be called when the composition is ready. I did a working example that changes the composition on button click.




回答2:


Have you tried applying it to both of the ids present:

<script type="text/javascript">
    $(document).ready(function(){
    jQuery('[data-url="10.htm"]').live('pageshow', function(){

        if($ && $.Edge && $.Edge.symbol.get($("Stage"))){
            $('#Stage, #Stage > div').show();
            $.Edge.symbol.get($("#Stage")).play(0);

        }
    });

    jQuery('[data-url="11.htm"]').live('pageshow', function(){

        if($ && $.Edge && $.Edge.symbol.get($("Stage2"))){
            $('#Stage2, #Stage2 > div').show();
            $.Edge.symbol.get($("#Stage2")).play(0);

        }
    });
});

</script>


来源:https://stackoverflow.com/questions/14453079/how-to-add-two-same-adobe-edge-animation-in-single-html-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!