<!DOCTYPE?html>
<html>
<head>
<meta?charset="UTF-8">
<title>Document</title>
<script?src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"?charset="utf-8"></script>
<link?rel="stylesheet"?type="text/css"?>
<script>
$(".article-title?a").hover(function(){
$("this").addClass("animated?shake");},
function(){
$("this").removeClass("animated?shake");
?});
??</script>
</head>
<body>
<h1?class="article-title">
??<a?href="#">ASDFHHLHLHLHLHLH</a>
??</h1>
</body>
</html>希望的效果是鼠標經(jīng)過H1標題的時候,文字出現(xiàn)shake效果.animate.css 是一個開源的動畫效果庫 ?官網(wǎng):https://daneden.github.io/animate.css/ 但是我在使用的時候發(fā)現(xiàn)出不來效果,求幫助
7 回答

woshiajuana
TA貢獻211條經(jīng)驗 獲得超152個贊
2個錯誤
一:$("this").addClass("animated?shake");這句寫錯啦
應該是$(this).addClass("animated?shake");
二:js操作元素的時候,js代碼最好放在元素標簽之后
修改的代碼我已經(jīng)發(fā)啦
不過能觸發(fā)那個hover事件了,樣式也加上元素標簽上去了,但動畫效果沒出來,不知道你這樣使用對不對,不過樣式是加上去了

六道骸
TA貢獻30條經(jīng)驗 獲得超6個贊
$(".article-title?a").hover(function(){
????$(this).addClass("animated?shake");
},
function(){
????$(this).removeClass("animated?shake");
?});

慕粉3232243
TA貢獻4條經(jīng)驗 獲得超3個贊
<script?>
$(function(){
$(".article-title?a").hover(function(){
$("this").addClass("animated?shake");},
function(){
$("this").removeClass("animated?shake");
?});
})
</script?>
- 7 回答
- 1 關注
- 2369 瀏覽
添加回答
舉報
0/150
提交
取消