글
animation 2
JS
2014. 5. 21. 18:32
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 38 39 40 41 42 | <!DOCTYPE html> <html> <head> <title>hello</title> <script src='./js/jquery-1.11.1.js'></script> <script src='./js/ch15.js'></script> <style> div{ width: 100px; height: 100px; background-color: orange; position: relative; } </style> <script> $(document).ready(function() { $('button').click(function(){ var html = $(this).html(); var evalText = "$('div')." + html; eval(evalText); }); setInterval(function(){ $('div').animate({left: '500'},1000).animate({left:'0'},1000); },2000); }); //ready </script> </head> <body> <button>stop()</button> <button>stop(true)</button> <button>stop(false, true)</button> <button>stop(true, true)</button> <div> </div> </body> </html> |
글
animiation
JS
2014. 5. 21. 17:59
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 38 | <!DOCTYPE html> <html> <head> <title>hello</title> <script src='./js/jquery-1.11.1.js'></script> <script src='./js/ch15.js'></script> <style> div{ width: 50px; height: 50px; background-color: orange; position: relative; } </style> <script> $(document).ready(function() { $('div').click(function(){ $(this).animate({left: '+=60'},2000).animate({width: '+=60'},2000).animate({height: '+=60'},2000); //$(this).off(); }); setTimeout(function(){ $('div').clearQueue(); //$('div').hide(); },3000); }); //ready </script> </head> <body> <div> </div> </body> </html> |
글
a box getting large
JS
2014. 5. 21. 17:11
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 38 | <!DOCTYPE html> <html> <head> <title>hello</title> <script src='./js/jquery-1.11.1.js'></script> <script src='./js/ch15.js'></script> <style> div { width: 50px; height: 50px; background-color: orange; } </style> <script> $(document).ready(function() { $('div').click(function(){ var width = $(this).css('width'); var height = $(this).css('height'); $(this).animate({ width: parseInt(width)+50, height: parseInt(height)+50 }, 'speed'); }); }); //ready </script> </head> <body> <div> </div> </body> </html> |