1

CSS3、HTML5、ASP.NET MVC4 C# を使用。MS ビジュアル スタジオ。

私は次のCSSを持っています...

.animated{-webkit-animation-fill-mode:both;
      -moz-animation-fill-mode:both;
      -ms-animation-fill-mode:both;
      animation-fill-mode:both;
      -webkit-animation-duration:1s;
      -moz-animation-duration:1s;
      -ms-animation-duration:1s;
      -o-animation-duration:1s;
      animation-duration:1s;}
@-webkit-keyframes bounceInRight {
0% {
    opacity: 0;
    -webkit-transform: translateX(2000px);
}   60% {
    opacity: 1;
    -webkit-transform: translateX(-30px);
}

80% {
    -webkit-transform: translateX(10px);
}

100% {
    -webkit-transform: translateX(0);
}
}

@-moz-keyframes bounceInRight {
0% {
    opacity: 0;
    -moz-transform: translateX(2000px);
}

60% {
    opacity: 1;
    -moz-transform: translateX(-30px);
}

80% {
    -moz-transform: translateX(10px);
}

100% {
    -moz-transform: translateX(0);
}
}

@keyframes bounceInRight {
0% {
    opacity: 0;
    transform: translateX(2000px);
}

60% {
    opacity: 1;
    transform: translateX(-30px);
}

80% {
    transform: translateX(10px);
}

100% {
    transform: translateX(0);
}
}

img.bounceInRight {
-webkit-animation-name: bounceInRight;
-moz-animation-name: bounceInRight;
animation-name: bounceInRight;
}    

Razor Viewスニペットは...

<div class="row rowpadding">
        <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
            @Html.Action("BlogTags", "Blog")
            @Html.Action("BlogMonths", "Blog")  
        </div>
        <div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
            <div class="row rowpadding">
                @foreach (var item in Model.BlogPosts)
                {
                    if(isFirst)
                    {
                        isFirst = false;
                    } else
                    {
                    <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 news-cata-div-size">
                        <div><img class="bounceInRight" src="~/Themes/Renray/Content/images/small-1.png" /></div>
                        <div><span class="News-item-Date">@item.CreatedOn.ToString("D")</span></div>
                        <div><a class="News-item-title" href="@Url.RouteUrl("BlogPost", new { SeName = item.SeName })">@item.Title</a></div>
                        <div class="post-body">
                           @Html.Raw((item.Body.Length > 200 ? item.Body.Substring(0,200) : item.Body))
                           <a href="@Url.RouteUrl("BlogPost", new { SeName = item.SeName })">
                               ...Read More?
                           </a>
                        </div>
                    </div>
                    }
                }

            </div>
        </div>
    </div>

私が提供したビュースニペットが大きい理由は、皆さんに全体を見てもらいたいからです。

問題に関しては、アニメーションは画像の反復ごとに右から跳ね返ることになっています (動的画像の表示コードはまだ不完全ですが、それは関係ありません)。

ロード時に何が起こるかは何もありません。アニメーション効果はまったくありません。私が間違っていることを皆さんが指摘できるかどうか疑問に思っています。

どうもありがとう!

4

1 に答える 1

1

問題は、アニメーションの塗りつぶしモードと期間が.animated、Razor ビュー内のどの要素にも適用されていないクラスに適用されていることです。

これを修正するには、このクラスをimg要素に追加するだけです。

<img class="animated bounceInRight"
     src="~/Themes/Renray/Content/images/small-1.png" />

.animatedまたは、とbounceInRightクラスをマージします。

img.bounceInRight {
    -webkit-animation-fill-mode:both;
    moz-animation-fill-mode:both;
    -ms-animation-fill-mode:both;
    animation-fill-mode:both;
    -webkit-animation-duration:1s;
    -moz-animation-duration:1s;
    -ms-animation-duration:1s;
    -o-animation-duration:1s;
    animation-duration:1s;
    -webkit-animation-name: bounceInRight;
    -moz-animation-name: bounceInRight;
    animation-name: bounceInRight;
}  
于 2013-11-07T15:58:56.243 に答える