0
你能幫助理解爲什麼shake effect
在我的情況下不起作用嗎? 代碼:搖動效果不起作用
$('.vote').on('click', function (e) {
e.preventDefault();
$("body, html").animate({
scrollTop: $($(this).attr('href')).offset().top
},{
duration: 600,
complete: $('#shake').effect('shake')
});
});
我也試圖把effect
的preventDefault
後卻又沒有成功。如果我將它稱爲on click
事件以外,它將正常工作。 提前謝謝!
編輯: HTML部分:
<div class="col-xs-6 col-sm-6">
<span class="upper">
<a href="#force-reg"><span style="cursor:pointer;font-size: 40px;color: deepskyblue" class="unsigned glyphicon glyphicon-thumbs-up"></span></a>
</span>
<span style="font-size: 40px; color: grey" class="thumb-post-up_<?= $post->id ?>"><?= $vote_up ?></span>
</div>
<div class="col-xs-6 col-sm-6">
<span class="upper">
<a href="#force-reg"><span style="cursor:pointer;font-size: 40px;color: grey" class="unsigned glyphicon glyphicon-thumbs-down"></span></a>
</span>
<span style="font-size: 40px; color: grey" class="thumb-post-down_<?= $post->id ?>"><?= $vote_down ?></span>
</div>
#shake
格:
<?php if(!(\Yii::$app->user->isGuest)) : ?>
<div class="col-md-6 text-right custom-title">
<span style="cursor:pointer;margin-right: 12px;" id="add-comment" class="button button-accent">Добави коментар</span>
</div>
<?php else : ?>
<div id="shake" class="col-md-6 col-sm-6 col-xs-12 text-right custom-title">
<a href="http://find-doctor.webbuild.com/user/register"><span style="cursor:pointer;margin-right: 12px;"class="button button-accent">Само регистрираните потребители могат да коментират и гласуват!</span></a>
</div>
<?php endif; ?>
請分享你的HTML代碼,以及 – Shiladitya
我創建了一個簡單的例子https://jsfiddle.net/qoaqw3hg/1/ – Shiladitya
在您的示例中無法看到按鈕。而我的代碼仍然無法工作:) –