0

我有一个LinkButton控件“添加到包”,单击时我想调用一个添加CSS动画的 JavaScript 函数。它适用于除 Edge 之外的所有其他浏览器。如果其他人也有这个问题,我试图在网上进行研究,但我找不到任何东西。如果我只是在 OnClientClick 中调用“alert('hello'); 它可以工作。有没有人遇到过这个问题并且想要我可以解决它吗?

<asp:LinkButton ID="_addToCart" ToolTip="Add to Bag" runat="server" OnClick="AddToCart_Click" OnClientClick="return Pulse();"  ClientIDMode="Static" Text="Add to Bag"  />
function Pulse() { 
    $('#totalItemBag').addClass("pulse2");
    $('#backgroundAnimation').addClass("backgroundChange");
}
.pulse2 {
    animation: pulse2 1s linear infinite;
    -webkit-animation-iteration-count: 1;*/ 
    animation-iteration-count: 1;
}

@keyframes pulse2 {
    0% {
        -webkit-transform: scale(1);
        -moz-transform: scale(1);
        -o-transform: scale(1);
        -ms-transform: scale(1);
        transform: scale(1);
    }
    25% {
        -webkit-transform: scale(1.2);
        -moz-transform: scale(1.2);
        -o-transform: scale(1.2);
        -ms-transform: scale(1.2);
        transform: scale(1.2);
        background: url("../Images/icon-mybag-default.png") no-repeat;
        background-position: top;
        width: 50%;
        height: 50px;
    }
    50% {
        -webkit-transform: scale(1.4);
        -moz-transform: scale(1.4);
        -o-transform: scale(1.4);
        -ms-transform: scale(1.4);
        transform: scale(1.4);
        background: url("../Images/icon-mybag-default.png") no-repeat;
        background-position: top;
        width: 50%;
        height: 50px;
    }
    75% {
        -webkit-transform: scale(1.2);
        -moz-transform: scale(1.2);
        -o-transform: scale(1.2);
        -ms-transform: scale(1.2);
        transform: scale(1.2);
        background: url("../Images/icon-mybag-default.png") no-repeat;
        background-position: top;
        width: 50%;
        height: 50px;
    }
    100% {
        -webkit-transform: scale(1);
        -moz-transform: scale(1);
        -o-transform: scale(1);
        -ms-transform: scale(1);
        transform: scale(1);
    }
}
4

1 回答 1

0

我很确定这与您在 CSS 中的 */ 遗忘标记相关联。

在此处输入图像描述

于 2015-12-08T12:50:38.917 回答