Sublime Text
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> <style type="text/css"> .father{ border:1px solid black; position:relative; margin-top:20px; height:300px; } .child{ background-color:yellow; width:30px; height:30px; position:absolute; left:0px; } </style> </head> <body> <button type="button">Click here</button> <div class="father"> <div class="child"></div> </div> <script> $(document).ready(function(){ $("button").click(function(){ $(".child").animate({left:"500px"}); }); }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> <style type="text/css"> .father{ border:1px solid black; position:relative; margin-top:20px; height:300px; } .child{ background-color:yellow; width:30px; height:30px; position:absolute; left:0px; } </style> </head> <body> <button type="button">Click here</button> <div class="father"> <div class="child"></div> </div> <script> $(document).ready(function(){ $("button").click(function(){ $(".child").animate({left:"500px"}); }); }); </script> </body> </html>