1

I used some jQuery for lazy loading and must add the text (data-scroll-reveal) to effects and I am using adobe edge animate and the adobe edge by automatically render div with id but I need to put the (data-scroll-reveal) to effect to div its self

I am used for lazy loading the scrollreveal http://scrollrevealjs.org/

Its render in source code like

<div id="Stage_Ellipse" style="position: absolute; margin: 0px; 
 left: 0px; top: 0px; width: 166px; height: 166px; right: auto; 
 bottom: auto; border-radius: 50%; transform-origin: 50% 50% 0px; 
 transform: translate(66px, 16px) rotate(0deg) scale(1, 1); 
 border: 0px none rgb(0, 0, 0); background-color: 
 rgb(192, 192, 192);" class="Stage_Ellipse_id">
</div>

is there any way to add the (data-scroll-reveal) to div of

i mean like below

<div id="Stage_Ellipse" data-scroll-reveal >

or any way to delaying an Edge Animate until visible ?

Web_Designer
  • 64,966
  • 87
  • 197
  • 254
Mohmoh
  • 11
  • 5

1 Answers1

1

Ramond Camden explains it really well with almost 6 blog posts dedicated to this issue:

Below is the text from the blog verbatim:

Delaying an Edge Animate asset until visible - Part 1 (April 3, 2013)

First, ensure you disable autoplay on the Stage element:

Next, click on the "Open Actions" panel and enter some text for the creationComplete event. I don't write much JavaScript directly in Edge Animate, instead, I simply put in something simple, like console.log('yo mama!'), just to get Edge Animate to create the event and make it easier for me to find in my editor.

I created a simple application, ran the code, and ensured that it was not running (since I had disabled autoplay). Now for the fun part. How do we tell if we the Edge Animate asset is visible? I turned to Stack Overflow and found a great utility for this (well, for DOM items in general): Check if element is visible after scrolling As you can see, it checks the Window's current scroll setting as well as the DOM item's size.

Given this function, I decided on this basic pseudo-code:

if(visible) run the animation else listen for scroll events and check if visible

Here is the code I came up with:

/***********************
* Adobe Edge Animate Composition Actions
*
* Edit this file with caution, being careful to preserve 
* function signatures and comments starting with 'Edge' to maintain the 
* ability to interact with these actions from within Adobe Edge Animate
*
***********************/
(function($, Edge, compId){
var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes

   //Edge symbol: 'stage'
   (function(symbolName) {


      Symbol.bindSymbolAction(compId, symbolName, "creationComplete", function(sym, e) {
         // insert code to be run when the symbol is created here
         console.log('Start');

    //http://stackoverflow.com/a/488073/52160
        function isScrolledIntoView(elem)
        {
            var docViewTop = $(window).scrollTop();
            var docViewBottom = docViewTop + $(window).height();

            var elemTop = $(elem).offset().top;
            var elemBottom = elemTop + $(elem).height();

            return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
              && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop) );
        }         

        if(isScrolledIntoView(sym.element)) {
            sym.play(0) 
        } else {
            $(window).on("scroll", function(e) {
            if(isScrolledIntoView(sym.element)) {
                console.log('Start me up'); 
                sym.play(0);
                $(window).off("scroll");
            }
        });
        }

      });
      //Edge binding end

   })("stage");
   //Edge symbol end:'stage'

})(jQuery, AdobeEdge, "EDGE-62515662");

You can try a demo of this here: http://www.raymondcamden.com/demos/2013/apr/3/Untitled-1.html Please try not to be too amazed at my incredible animation and design skills.

Aatif Khan
  • 151
  • 2
  • 5
  • You should summarize the explanation in your answer so that your answer is still useful if the linked content changes or becomes unreachable. – skrrgwasme Oct 15 '14 at 16:40
  • @skrrgwasme I have edited my post and quoted important bit from the blog post. – Aatif Khan Oct 21 '14 at 09:49