Skip to content

xat/csseval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery-csseval

use expressions to evaluate css on the fly. You can use this lib for parallax stuff, for example.

Usage

<script src="jquery.js"></script>
<script src="csseval.js"></script>

<!-- init -->

<script>
$(function() {
    $('.parallax').csseval();
});
</script>

<!-- ...later in your markup: -->

<div class="parallax" data-trigger="scroll" data-css="{ 'margin-left': this.scrollTop() * 0.5 + 'px' }">
Hello World!
</div>

<!--
the above code does this:
each time a scroll event gets triggered data-css gets evaluated and the resulting css gets
set to the element ( with $el.css(...) ).
Notice how we used the expression 'scrollTop() * 0.5' inside there.
-->

License

MIT

About

use expressions to evaluate css on the fly.

Resources

License

Stars

Watchers

Forks

Packages

No packages published