JQuery can't change font-size -
i need change font size on hover, think doesn't work me because i'm using bootstrap. have:
<!doctype html> <html> <head> <title>marichihueu</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dtfge/zgomypp7qbhy4gwmegsbsdzecxz7iritjcc3spuftf0kufbdz/ixg7artxmdjlxdmezhubenikykgvyq==" crossorigin="anonymous"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"> </script> <script> $(document).ready(mymain); function mymain(){ $("a").hover(more); function more(){ $(this).animate({font-size:'50px'},"fast"); } } </script> </head> <body> <header> <div class="container-fluid"> <h1>test</h1> </div> </header> <div class="container"> <div class="row well"> <div> <input type="text" /> </div> <div class="row-fluid"> <ul class="nav nav-pills"> <li><a href="#">a</a></li> <li><a href="#">b</a></li> <li><a href="#">c</a></li> <li><a href="#">d</a></li> <li><a href="#">e</a></li> <li><a href="#">f</a></li> <li><a href="#">g</a></li> <li><a href="#">h</a></li> <li><a href="#">i</a></li> <li><a href="#">j</a></li> <li><a href="#">k</a></li> <li><a href="#">l</a></li> <li><a href="#">m</a></li> <li><a href="#">n</a></li> <li><a href="#">Ñ</a></li> <li><a href="#">o</a></li> <li><a href="#">p</a></li> <li><a href="#">q</a></li> <li><a href="#">r</a></li> <li><a href="#">s</a></li> <li><a href="#">t</a></li> <li><a href="#">u</a></li> <li><a href="#">v</a></li> <li><a href="#">x</a></li> <li><a href="#">y</a></li> <li><a href="#">z</a></li> </ul> </div> </div> </div> </body> </html>
i don't know wrong, maybe bootstrap rule.
sorry bad english.
you need use 'font-size'
instead of font-size
$(document).ready(mymain); function mymain(){ $("a").hover(big , small); function big(){ $(this).animate({'font-size':'50px'},"fast"); } function small(){ $(this).animate({'font-size':'15px'},"fast"); } }
note : can use custom duration instead of 'fast' , 'slow' default duration : 400 find here animate()
but prefer use hover in css in @pekka answer , use transition .. anyway you
Comments
Post a Comment