Skip to content

Migrate from v2 to v3

Boniface Pereira edited this page Jun 18, 2017 · 2 revisions

V3 introduces a lot of new features, so its not possible to make it backwards compatible with v2. Its recommended to update your plugin to v3, which is much more stable.

Defining buttons

The way you define buttons in v3 is completely changed.

v2.

// limited to two buttons.
$.confirm({
    confirmButton: 'confirm button text here',
    confirmButtonClass: 'btn-danger',
    confirm: function(){
        // button action goes here.
    },
    cancel: ..,
})

v3.

$.confirm({
    buttons: {
        tom: { // long hand way to define a button
            btnClass: 'btn-danger',
            text: 'button text here', // if ignored 'tom' will be used,
            action: function(){
                // button action goes here.
            },
        },
        jerry: function(){ // short hand way to define a button
            // button action goes here
        }
    }
})

options

  • button name 'okay' is changed to 'ok',
  • opacity is changed to bgOpacity and is set to null by default
  • theme names, 'white' is changed to 'light' and 'black' is changed to 'dark' (white and black are set alias, will still work)
  • all the button options are moved inside the button object.
  • default animation speed is changed from 500 to 400
  • keyboardEnabled option is removed, individual keyboard events are added to buttons as key attribute.

css changes

  • keyframes jconfirm-rotate is changed to jconfirm-spin (used for loading animation)
  • jconfirm-noscroll class is changed to jconfirm-no-scroll
  • all elements inside jconfirm-box are not prefixed with 'jconfirm-'
  • the content overflow was handled using 'clip' in v2, that is changed to 'overflow: hidden' in v3.
  • animation prefix changed from 'anim-' to 'jconfirm-animation-'
Clone this wiki locally