0

http://github.hubspot.com/odometer/の odometer.js を使用しています。odometer.js bia JavaScript の期間を設定する方法はありますか (たとえば、走行距離計が値 0 から 47 まで実行され、終了までに 10 秒かかります)。私はこの質問を見つけましたhttps://github.com/HubSpot/odometer/issues/91そして、誰かが2か所で変更する必要があると言いました(そのうちの1つはcssで、私にとってはcssが機能しています)。css one は次のようなものです:

.odometer.odometer-animating-up, .odometer.odometer-animating-down.odometer-animating .odometer-ribbon-inner {
      -webkit-transition-duration: 10s !important;
      -moz-transition-duration: 10s !important;
      -ms-transition-duration: 10s !important;
      -o-transition-duration: 10s !important;
       transition-duration: 10s !important;
}

}

しかし、私の場合は、javascript、css を使用して設定したいと考えています。私はこのようにjqueryを使ってみました:

$(element).css( 'transitionDelay' : duration+'s') 

しかし、機能していません。ドキュメントのものを使用しても何もしませんでした:

window.odometerOptions = {
    auto: false, // Don't automatically initialize everything with class 'odometer'
    selector: '.my-numbers', // Change the selector used to automatically find things to be animated
    format: '(,ddd).dd', // Change how digit groups are formatted, and how many digits are shown after the decimal point
    duration: 3000, // Change how long the javascript expects the CSS animation to take
    theme: 'car', // Specify the theme (if you have more than one theme css file on the page)
    animation: 'count' // Count is a simpler animation method which just increments the value,
                 // use it when you're looking for something more subtle.
};

解決策はありますか?

アップデート:

これがフィドルです。私はまだ css を使用して期間を制御していることに注意してください

http://jsfiddle.net/mtamwd6w/

4

1 に答える 1