html - How to stop font flickering & dissapering in jquery animation. -


http://codepen.io/anon/pen/ojbzzo having trouble this. font flickers disappears after animation. i've provided html , css. i'm thinking problems lies way structured divs. maybe. please.

<body>  <div id="container">    <div id="box-2" class="box">     <div class="menu-bar">       <p class="nav">contact</p>     </div>   </div>   <div id="box-3" class="box">    <div class="menu-bar">       <p class="nav">profolio</p>     </div>   </div>   <div id="box-4" class="box">     <div class="menu-bar">       <p class="nav">about me</p>     </div>   </div>   <div id="box-5">     <div>       <h1>james blunt</h1>       <p>expert roller</p>     </div>   </div>  </div>    </body> body{   color:#fff;   font-family: 'open sans', sans-serif; } html {-webkit-font-smoothing: antialiased}  .box {   } html, body, #container {   margin:0px auto;   height:500px;   width:auto;   background-color:#0ee3b8; }  #box-2 {    float:right;   width: 21%;    height: 100px;    outline: 1px solid olive; } #box-3 {    float:right;   width: 22%;    height: 100px;    outline: 1px solid fuchsia; } #box-4 {    float:right;   width: 22%;    height: 100px;    outline: 1px solid maroon;  } #box-5 {   padding-top:200px;   clear:both;   text-align:center;   width: 100%;    height: 300px;    outline: 1px solid maroon;   } .menu-bar {   padding-top:0;   margin-top:0;   height:10px;   width:125px;   background:#000;   position:relative;  } .nav {    margin:0px;   padding-top:25px;   font-size:13px;   float:right;   color:#000; }    h1{   margin:0;   text-shadow: 1px 1px #000;  } p{   color:#666666; }        var main = function(){ $(".menu-bar").hover(function(){     $(this).animate({ height: "20px" }, {queue: false}); }, function() {     $(this).animate({ height: "10px" }, {queue: false}); });    }  $(document).ready(main); 

this you're trying do:

var main = function() {    $("#box-2, #box-3, #box-4").hover(function() {      $(this).find('div').animate({        "margin-top": "20px"      }, {        queue: false      });    }, function() {      $(this).find('div').animate({        "margin-top": "10px"      }, {        queue: false      });    });    }    $(document).ready(main);
body {    color: #fff;    font-family: 'open sans', sans-serif;  }  html {    -webkit-font-smoothing: antialiased  }  .box {} html,  body,  #container {    margin: 0px auto;    height: 500px;    width: auto;    background-color: #0ee3b8;  }  #box-2,  #box-3,  #box-4 {    float: right;    width: 21%;    height: 100px;    border: 1px solid olive;  }  #box-5 {    padding-top: 200px;    clear: both;    text-align: center;    width: 100%;    height: 300px;    outline: 1px solid maroon;  }  .menu-bar {    padding-top: 0;    margin-top: 0;    height: 10px;    width: 125px;    background: #000;    position: relative;  }  .nav {    margin: 0px;    padding-top: 25px;    font-size: 13px;    float: right;    color: #000;  }  h1 {    margin: 0;    text-shadow: 1px 1px #000;  }  p {    color: #666666;  }  var main=function() {    $(".menu-bar").hover(function() {      $(this).animate( {        height: "20px"      }      ,      {        queue: false      }      );    }    ,    function() {      $(this).animate( {        height: "10px"      }      ,      {        queue: false      }      );    }    );  }
<head>    <link href='https://fonts.googleapis.com/css?family=open+sans:300italic' rel='stylesheet' type='text/css'>    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>  </head>    <body>      <div id="container">        <div id="box-2" class="box">        <div class="menu-bar">          <p class="nav">contact</p>        </div>      </div>      <div id="box-3" class="box">        <div class="menu-bar">          <p class="nav">profolio</p>        </div>      </div>      <div id="box-4" class="box">        <div class="menu-bar">          <p class="nav">about me</p>        </div>      </div>      <div id="box-5">        <div>          <h1>sam asuma</h1>          <p>web developer</p>        </div>      </div>      </div>      </body>


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -