html - DIV does not move or scale via JQuery UI -


i'm getting started html 5 app. when page loads, have logo in center of screen. need logo in center of screen begin with. user can begin using app clicking "begin" button. when happens, want animate logo in 2 ways:

  1. i want logo move current location upper left corner (with bit of padding top , left)
  2. i want scale image down.

in attempt this, i'm using jquery ui. here have:

<body>     <div id="wrapper">         <div id="content">             <div id="logo"></div>             <input type='button' value='begin' onclick='return beginbutton_click();' />         </div>     </div>      <div id="footer">         <span id="greeting" class="footer-content">             hello         </span>         <span class="separator">|</span>         <a href="#" target="_blank" class="footer-content">view status</a>     </div>       <script type='text/javascript'>       function beginbutton_click() {         $("#load").animate({           width: "30%",           height: "30%",           opacity: 0.4         }, 1500);        }     </script> </body> 

my css defined in file. css looks this:

html, body {     margin: 0;     padding: 0;     height: 100%; } body, #footer {     background-color: #2d2d2d; }  #wrapper {     width: 100%;     min-height: 100%;     margin-bottom: -34px;     background-color: #4cff00;     text-align: center;     overflow: auto; }  #content {     margin-top: 200px;     width: 350px;     display: inline-block;     position: relative;     text-align: center;     margin-bottom: 30px; }  #logo {     position: relative;     display: inline-block;     width: 100%;     height: 70px;     margin-bottom: 5px;     background: transparent url(/images/logo.png) no-repeat center center; }  #footer {     text-align: left;     width: 100%;     overflow: hidden; }  .footer-separator {     display: inline-block;     vertical-align: middle; } #info{     margin-left: 10px; } .footer-content, .action {     display: inline-block;     vertical-align: middle;     font-weight: normal; } 

currently, logo div not scale or move upper left. can't figure out how move div because relatively positioned. yet, need in middle of screen. beyond that, have no idea why div not scaling. can please me?

thank you!

you should change #load #logo select div in jquery selector animate call. in order move top left, can use position() jquery ui.

$('#logo').animate({ /* call here */ }) .position({ my: 'center', at: 'left top', of: document }); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -