Одометр установить продолжительность с помощью JavaScript

Я использую odometer.js с http://github.hubspot.com/odometer/. Есть ли способ установить продолжительность odometer.js bia javascript (например, пробег одометра от 0 до 47, на завершение которого требуется 10 секунд)? Я нашел этот вопрос https://github.com/HubSpot/odometer/issues/91 и кто-то сказал, что мне нужно поменять на 2 место (один из них css и для меня css один работает). CSS один, как это:

.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/

0 ответов

Это действительно старый метод, но для тех, кто ищет ответ, метод из документации действительно работает, но вы должны установить его перед загрузкой файла CDN odometer.js:

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.
};
Другие вопросы по тегам