0
ユーザーが特定のセクションにある場合はcss
を追加しようとしていますが、実現できません。 css
は、この(それは私の棒をアニメーション化)である:特定のセクションにある場合はCSSを適用してください
$(function(){
$(window).bind('scroll', function() {
$('#skill-section').each(function() {
var post = $(this);
var position = post.position().top - $(window).scrollTop();
if (position <= 0) {
post.addClass('stye', ''); // I tried to add the css here, but it didn't work
}
}
});
});
});
私はそれらの青いバーが左から行きたい:
.swift { width:70%; -moz-animation:swift 2s ease-out; -webkit-animation:swift 2s ease-out; }
.java { width:50%; -moz-animation:java 2s ease-out; -webkit-animation:java 2s ease-out; }
.python { width:60%; -moz-animation:python 2s ease-out; -webkit-animation:python 2s ease-out; }
.backend { width:30%; -moz-animation:backend 2s ease-out; -webkit-animation:backend 2s ease-out; }
.html5 { width:55%; -moz-animation:html5 2s ease-out; -webkit-animation:html5 2s ease-out; }
.css3 { width:55%; -moz-animation:css3 2s ease-out; -webkit-animation:css3 2s ease-out; }
@-moz-keyframes swift { 0% { width:0px;} }
@-moz-keyframes java { 0% { width:0px;} }
@-moz-keyframes python { 0% { width:0px;} }
@-moz-keyframes backend { 0% { width:0px;} }
@-moz-keyframes html5 { 0% { width:0px;} }
@-moz-keyframes css3 { 0% { width:0px;} }
@-webkit-keyframes swift { 0% { width:0px;} }
@-webkit-keyframes java { 0% { width:0px;} }
@-webkit-keyframes python { 0% { width:0px;} }
@-webkit-keyframes backend { 0% { width:0px;} }
@-webkit-keyframes html5 { 0% { width:0px;} }
@-webkit-keyframes css3 { 0% { width:0px;} }
そして、これは方法ですが、私は、ユーザーが特定のセクションにあるかどうかを検出しますユーザーが特定のセクションにある場合にのみ、右に移動します。今はページの読み込み時にそれを行い、ユーザはそれを見ないかもしれないからです。
P/S:あなたは本当にクロスブラウザの互換性を最大化したい場合は、 '-o-keyframe'宣言を追加することができます;)+1、それはです本当に素敵な概念実証デモで本当に良い答えです。 – Terry
@Terry。ありがとう。ニースの追加も。 – Ionut
おっと、私は '-o-keyframes'を意味し、複数形を忘れていました:) – Terry