Mifas Mifas - 1 month ago 6
HTML Question

How to change jQuery pickadate theme

Hi I'm using jQuery Plugin called pickadate.js. But I cannot get how to change the theme. There is two theme default and classic. I want to change it to classic.

Answer

You just include the theme CSS for the theme you want ... Docs are here

If you want the theme picker as shown the the plugins home page .. check this pages source ...

HTML :

<span class="menu__link">
  Themes: 
  <input class="theme-toggle__input" type="radio" id="show_theme_default" name="show_theme" value="default" checked hidden>
  <label class="theme-toggle__label" for="show_theme_default">default</label> and 
  <input class="theme-toggle__input" type="radio" id="show_theme_classic" name="show_theme" value="classic" hidden>
  <label class="theme-toggle__label" for="show_theme_classic" class="checked-negative">classic</label>
</span>

JavaScript:

var themeSelected = window.localStorage ? localStorage.getItem( 'theme' ) : '',
    $themeLinks = $( '#theme_base, #theme_date, #theme_time' ),
    updateStylingLinks = function( value ) {
        value = value || 'default'
        $( '#show_theme_' + value ).attr( 'checked', true )
        $themeLinks.detach()
        $themeLinks.each( function() {
            this.href = this.href.replace( /(.+\/)(\w+)(.+)/, '$1' + value + '$3' )
        })
        $themeLinks.appendTo( 'head' )
    }

if ( themeSelected ) {
    updateStylingLinks( themeSelected )
}

$( '[name=show_theme]' ).on( 'change', function() {
    var value = this.value
    updateStylingLinks( value )
    if ( window.localStorage ) {
        localStorage.setItem( 'theme', value )
    }
})