Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function Switchery.prototype.setPosition is not Compatible with IE11 Browser. #161

Open
AshishCGS opened this issue Jun 25, 2018 · 4 comments

Comments

@AshishCGS
Copy link

AshishCGS commented Jun 25, 2018

Function Switchery.prototype.setPosition is not Compatible with IE Browser but its working fine with other browsers. Kindly help.

Example Calling:

Switchery.prototype.bindClick = function() {
var parent = this.element.parentNode.tagName.toLowerCase()
, labelParent = (parent === 'label') ? false : true;
this.setPosition(labelParent);
this.handleOnchange(this.element.checked);
};

Switchery.Js file and Below method.

Switchery.prototype.setPosition = function (clicked) {
debugger;
var checked = this.isChecked()
, switcher = this.switcher
, jack = this.jack;

if (clicked && checked) checked = false;
else if (clicked && !checked) checked = true;

if (checked === true) {
this.element.checked = true;

if (window.getComputedStyle) jack.style.left = parseInt(window.getComputedStyle(switcher).width) - parseInt(window.getComputedStyle(jack).width) + 'px';
else jack.style.left = parseInt(switcher.currentStyle['width']) - parseInt(jack.currentStyle['width']) + 'px';

if (this.options.color) this.colorize();
this.setSpeed();

} else {
jack.style.left = 0;
this.element.checked = false;
this.switcher.style.boxShadow = 'inset 0 0 0 0 ' + this.options.secondaryColor;
this.switcher.style.borderColor = this.options.secondaryColor;
this.switcher.style.backgroundColor = (this.options.secondaryColor !== defaults.secondaryColor) ? this.options.secondaryColor : '#fff';
this.jack.style.backgroundColor = (this.options.jackSecondaryColor !== this.options.jackColor) ? this.options.jackSecondaryColor : this.options.jackColor;
this.setSpeed();
}
};

@AshishCGS
Copy link
Author

@abpetkov Kindly help.

@AshishCGS AshishCGS changed the title Function Switchery.prototype.setPosition is not Compatible with IE Browser. Function Switchery.prototype.setPosition is not Compatible with IE11 Browser. Jun 25, 2018
@AshishCGS
Copy link
Author

this.element.checked is not working.

@AshishCGS
Copy link
Author

switchery.js.txt

@AshishCGS
Copy link
Author

@abpetkov Kindly Help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant