forked from martinsb/require-css
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
37 lines (35 loc) · 841 Bytes
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<style>
body {
font-family: sans-serif;
}
#test {
margin: 1em 0;
padding: .5em;
border: 1px solid black;
}
</style>
</head>
<body>
<h1>Loading CSS with Require JS demo</h1>
<div><button id="go">Test</button></div>
<div id="test">
<p>After you click the "Test" button, the background color of this element should change to red.</p>
</div>
<script src="require.js"></script>
<script>
(function(win){
var doc = win.document,
button = doc.getElementById('go');
button.addEventListener('click', function() {
require(['css!css/sample.css'], function() {
alert('Stylesheet has been loaded');
});
}, false);
})(window);
</script>
</body>
</html>