animation - Importing tweenMax into javascript -
im trying import tweenmax html, cant find im doing wrong... i´ve done in website.
<!doctype html> <html> <head lang="en"> <link rel="stylesheet" href="css/paginafinal.css"> <script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.17.0/tweenmax.min.js"></script> <meta charset="utf-8"> <title></title> </head>
here im make init;
<body onload="init()" onclick="pointerdefault(event)"> <input type="text" id="search" name="procurarpalavra" onkeypress="premirenter(event)"> <img src="search.png" alt="smiley face" id="ok" onclick="enviarpalavra(event)" > <img src="info.png" id="help"> <footer id="myfooter"> </footer>
the script goes here
function init() { var search = document.getelementbyid("ok"); var text = document.getelementbyid("search"); var = document.getelementbyid("help"); search.hover(function () { tweenmax.to(this, .35, {width: "80", height: "80"}) }, function () { tweenmax.to(this, .5, {width: "50", height: "50"}) }) text.hover(function () { tweenmax.to(this, .35, {width: "80", height: "80"}) }, function () { tweenmax.to(this, .5, {width: "50", height: "50"}) }) help.hover(function () { tweenmax.to(this, .35, {width: "100", height: "100"}) }, function () { tweenmax.to(this, .5, {width: "70", height: "70"}) }) } </script> </body> </html>
seems me expecting .hover()
of jquery work here not see jquery imported. wrong.
after loading jquery, either wrap search
, other variables jquery object e.g. $(search)
or use jquery them in first place e.g. var search = $('#ok');
instead of var search = document.getelementbyid('ok');
.
or, if looking avoid jquery, listen mouseover
, mouseout
events using addeventlistener
method.
Comments
Post a Comment