Skip to content

benfoxall/context-require

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

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

About

Context Require js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published