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

it is not working with bootstrap 4 #161

Open
gibbsvjy007 opened this issue Apr 30, 2017 · 4 comments
Open

it is not working with bootstrap 4 #161

gibbsvjy007 opened this issue Apr 30, 2017 · 4 comments

Comments

@gibbsvjy007
Copy link

gibbsvjy007 commented Apr 30, 2017

I am using latest bootstrap version and want to integrate your library. I am making web application using angular. I tried all possible ways but always it appears simple checkbox without any design applied. I checked in the DOM CSS and JS file of bootstrap-toggle is loaded properly..

Can you please help me to fix this ?

@jp1337
Copy link

jp1337 commented May 2, 2017

Hey gibbsvjy007,

I had the same issue an hour ago.
Here is my solution:

Replace the following strings in bootstrap-toggle.js and bootstrap-toggle.min.js:

Step 1

Toggle.DEFAULTS = {
	...
	offstyle: 'default',
	...
}

has to be

Toggle.DEFAULTS = {
	...
	offstyle: 'secondary',
	...
}

Step 2

Replace var $toggleHandle = $('<span class="toggle-handle btn btn-default">')
with var $toggleHandle = $('<span class="toggle-handle btn btn-secondary">')

@gibbsvjy007
Copy link
Author

@kingjp
Thanks for the solutions. This is also a nice solution.
But I managed to do this with the following library.

[http://ziscloud.github.io/angular-bootstrap-toggle/]

It is working without any changes in the library.
Hope it will help you.

Best,
Vijay

@jodier
Copy link

jodier commented Sep 19, 2017

Hi!

I also suggest to replace:
var $toggleOff = $('').html(this.options.off)
.addClass(this._offstyle + ' ' + size + ' active')
by:
var $toggleOff = $('').html(this.options.off)
.addClass(this._offstyle + ' ' + size)

With this modification, it is possible to use the new "outline" classes, for example:
data-onstyle="outline-warning" data-offstyle="outline-secondary"

Best regards,
Jérôme Odier

@deepakmahakale
Copy link

I have already raised a pull request 2 years ago #143

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

4 participants