将tweenMax导入javascript

将tweenMax导入javascript,javascript,animation,gsap,Javascript,Animation,Gsap,我试图导入TweenMax到我的html,但我找不到我做错了什么。。。我已经完成了他们在网站上说的一切 <!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.

我试图导入TweenMax到我的html,但我找不到我做错了什么。。。我已经完成了他们在网站上说的一切

<!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>

在这里,我做了初始化

<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>

剧本就在这里

函数init(){
var search=document.getElementById(“确定”);
var text=document.getElementById(“搜索”);
var help=document.getElementById(“帮助”);
search.hover(函数(){
TweenMax.to(这个0.35,{宽度:“80”,高度:“80”})
},函数(){
TweenMax.to(这个,.5,{宽度:“50”,高度:“50”})
})
text.hover(函数(){
TweenMax.to(这个0.35,{宽度:“80”,高度:“80”})
},函数(){
TweenMax.to(这个,.5,{宽度:“50”,高度:“50”})
})
help.hover(函数(){
TweenMax.to(这是.35,{宽度:“100”,高度:“100”})
},函数(){
TweenMax.to(这个,.5,{宽度:“70”,高度:“70”})
})   
}

在我看来,您希望jQuery在这里工作,但我没有看到任何jQuery被导入。我可能错了

加载jQuery后,您可以将
search
和其他变量包装到jQuery对象中,例如
$(search)
,也可以使用jQuery首先获取它们,例如
var search=$(“#确定”)而不是
var search=document.getElementById('ok')


或者,如果您希望避免使用jQuery,您可以使用
addEventListener
方法收听
mouseover
mouseout
事件。

发生了什么?控制台中有错误吗?如何调用
init()
函数?元素上是否有
ok
id?脚本是放在TweenMax脚本的上方还是下方?如果它在它们上面,它应该放在它们下面。@user3185775:嘿,我的建议对你有用吗?
    function init() {
        var search = document.getElementById("ok");
        var text = document.getElementById("search");
        var help = 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>