Skip to content
Context Require js
JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
test
LICENCE
README.md
cr-inview.js
cr.js

README.md

Context Require

This is a tiny script that allows you to load (require) js files based on the content of a page.

Usage

<div class="cr" data-cr="fancy">
	<p>This part is made all fancy</p>
</div>
…
…
<script data-main="js/main" src="/js/require.js"></script>
//--fancy.js

define(['jquery'], function($){

	$.fn.make_fancy = function(){
		this.animate({fontSize:'+=50'})
	};

	return function(content){
		$(content).find('p').make_fancy();
	}

});

//--main.js

require(['cr']);

see example.html

You can’t perform that action at this time.