You need to use javascript to locate the viewport and activate it when it becomes visible.
You can use javascript to detect and perform the transition, and then css or javascript to animate.
There are many jquery-based scripts to accomplish this. Here is one example:
1. Create the Html element that you want to check if it is in the viewport.
<div class="demo"></div>
2. Download the jQuery javascript library and jQuery Viewport Checker plugin at the end of your document.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="viewportchecker.js"></script>
3. Call the plugin of this element and do something in javascript.
<script> $(document).ready(function(){ $('.demo').viewportChecker({ </script>
source share