html - Scale image from the middle using jQuery -


is possible make image scale middle jquery? right it's going top left.

$( document ).ready(function() {      $("#logo").animate({          height: '+=100%',          width: '+=100%'      });    });
#logoblock  {      position: relative;      width: 700px;      height: 700px;      margin: auto;  }  #logo  {      position: absolute;      width: 0%;      height: 0%;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>  <div id="logoblock">      <div id="logo">      <img src="http://placehold.it/700x700">      </div>  </div>

is possible?

may b not want

$( document ).ready(function() { $("#logo").animate({     height: '+=100%',     width: '+=100%',     top: 0,     left:0 });  }); 

css

#logoblock { position: relative; width: 700px; height: 700px; margin: auto; } #logo { position: absolute; top:50%; left:50%; width: 0%; height: 0%; } 

fiddle http://jsfiddle.net/73h17m1t/

click run button after fiddle loaded , resize result frame full size best view.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -