javascript - Skrollr & relative mode fails to work -


i'm trying use skrollr library (https://github.com/prinzhorn/skrollr) create think simple bit of functionality mean when bottom-top attribute triggered (when top 25px above bottom viewport) opacity 0, , user scrolls down further opacity increase 1 when bottom of element 25px above bottom viewport.

however, when load html file states in console elements either skrollable-after or skrollable-between, when not case later 2 elements (at least when viewport obscuring later 2 elements). final element stated being skrollable-between when in reality far beneath bottom of viewport.

i did think may issue loading of various assets, s.refresh() doesn't change (at least in manner using it).

html follows, skrollr.js being latest source file on github (0.6.11).

any guidance appreciated.

<html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> <script type="text/javascript" src="skrollr.js"></script> </head> <body> <div class="column"><p>column 1</p> </div>  <div class="column"><p>column 2</p>      <div class="imp-text-one" data--25-bottom-top="opacity: 0;" data--25-bottom-bottom="opacity: 1">this important text</div>      <div class="placeholder"></div>      <div class="imp-text-two" data--25-bottom-top="opacity: 0;" data--25-bottom-bottom="opacity: 1">this important text</div>      <div class="placeholder"></div>      <div class="imp-text-three" data--25-bottom-top="opacity: 0;" data--25-bottom-bottom:"opacity: 1">     important text</div>  </div>  <script type="text/javascript">    s = skrollr.init(); </script> <script>  window.onload = function(){      s.refresh(); } </script> </body> </html> 

css below:

.column { width: 50%;  float: left; }  body { margin: 0; padding: 0; }  .imp-text-one { padding: 50px 10px 50px 10px; border-style: solid; }  .imp-text-two { padding: 50px 10px 50px 10px; border-style: solid; }  .placeholder { height: 400px; }  .imp-text-three { padding: 50px 10px 50px 10px; border-style: solid; } 

it's data-[offset]-(viewport-anchor)-[element-anchor] , not data-[offset]-(element-anchor)-[viewport-anchor].

for example first element has 2 keyframes both relative bottom of viewport. never gets close bottom!

correct:

<div class="imp-text-one" data--25-top-bottom="opacity: 0;" data--25-bottom-bottom="opacity: 1">this important text</div>  <div class="placeholder"></div>  <div class="imp-text-two" data--25-top-bottom="opacity: 0;" data--25-bottom-bottom="opacity: 1">this important text</div>  <div class="placeholder"></div>  <div class="imp-text-three" data--25-top-bottom="opacity: 0;" data--25-bottom-bottom:"opacity: 1"> important text</div> 

edit: need add proper doctype, e.g. <!doctype html>. otherwise browsers switch quirks mode, skrollr doesn't handle.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -