Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 60 lines (39 sloc) 0.914 kb
cabfd7b @JeffreyWay Demo for Nettuts
JeffreyWay authored
1 <!doctype html>
2 <html>
3 <head>
4 <title></title>
5 <link rel="stylesheet" href="style.css">
6 </head>
7 <body>
8
9 <div class="container grid">
10 <form>
11 <h2>HTML</h2>
12 <textarea id="html"></textarea>
13
14 <h2>CSS</h2>
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
15 <textarea id="css"></textarea>
cabfd7b @JeffreyWay Demo for Nettuts
JeffreyWay authored
16 </form>
17 </div>
18
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
19 <div class="output grid">
20 <iframe></iframe>
21 </div>
cabfd7b @JeffreyWay Demo for Nettuts
JeffreyWay authored
22
23 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
24
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
25 <script src="http://localhost:35729/livereload.js"></script>
26
cabfd7b @JeffreyWay Demo for Nettuts
JeffreyWay authored
27 <script>
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
28 (function() {
fb873bc @JeffreyWay Refactored JS
JeffreyWay authored
29 $('.grid').height( $(window).height() );
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
30
fb873bc @JeffreyWay Refactored JS
JeffreyWay authored
31 var contents = $('iframe').contents(),
32 body = contents.find('body'),
f7de61c @JeffreyWay Improved styleTag reference
JeffreyWay authored
33 styleTag = $('<style></style>').appendTo(contents.find('head'));
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
34
4ea1d4e @JeffreyWay Removed focus
JeffreyWay authored
35 $('textarea').keyup(function() {
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
36 var $this = $(this);
4ea1d4e @JeffreyWay Removed focus
JeffreyWay authored
37 if ( $this.attr('id') === 'html') {
38 body.html( $this.val() );
39 } else {
40 // it had to be css
41 styleTag.text( $this.val() );
42 }
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
43 });
f7de61c @JeffreyWay Improved styleTag reference
JeffreyWay authored
44
b480eda @JeffreyWay Updated to use contents, and fixed Firefox issue
JeffreyWay authored
45 })();
cabfd7b @JeffreyWay Demo for Nettuts
JeffreyWay authored
46
47 </script>
48
49 </body>
fb873bc @JeffreyWay Refactored JS
JeffreyWay authored
50 </html>
51
52
53
54
55
56
57
58
59
Something went wrong with that request. Please try again.