Bharat Patil
Bharat Patil

Reputation: 1408

CSS Transitions iOS 7 Phonegap

I have used toggle switch from this http://proto.io/freebies/onoff/ in my phonegap app.

It's been working fine on android and iOS6, however it's not working on iOS 7 phonegap app.

Does anyone know if there is any problem with CSS transition on iOS7 Webview?

Upvotes: 2

Views: 309

Answers (1)

Bharat Patil
Bharat Patil

Reputation: 1408

I have changed following code

Switchery.prototype.handleOnchange = function(state) {
  var evt = new Event('click');
  this.element.dispatchEvent(evt);

  if (typeof Event === 'function') {
    var event = new Event('change', { cancelable: true });
    this.element.dispatchEvent(event);
  } else {
    this.element.fireEvent('onchange');
  }
};

into this

Switchery.prototype.handleOnchange = function(state) {
    if ("createEvent" in document) {
        var event = document.createEvent("HTMLEvents");
        event.initEvent("change", false, true);
    } else {
        this.element.fireEvent('onchange');
    }
};

Also I have commented following lines (multiple of following) in setPosition() function of switchery.js

//    this.setSpeed();

For my complete changes

https://github.com/bharatpatil/switcheryJS-phonegap/blob/master/switchery.js

Upvotes: 1

Related Questions