-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
Update selector example codepen #32156
Conversation
Updates the selector example codepen for popovers.md and tooltips.md, to reflect the lack of the jQuery dependency.
@mdo: we should fork that and use our Pen. |
Well, that's what I actually proposed to do.. 🙄
|
Maybe I should mention that this example isn't supported in old IE because I used Also I kept |
RE: IE, that's OK, it's not supported on v5. Feel free to simplify the pen and I'll fork it and update this PR after you are done. :) |
@XhmikosR done. :) |
@alpadev can you check https://codepen.io/team/bootstrap/pen/e1ebd72cfda6962c984dfd274e39658f please? I made a few more needed changes. |
@XhmikosR looks much more polished now! Sorry for not putting more effort into it. I agree it's better with some comments on those helpers. About the code. The last minor updates I had done was to rename And for optimization I guess that // Disable selector checkbox, put a tooltip on it, and show the buttons panel
$("#use-selector").disabled = true;
new bootstrap.Tooltip($("#use-selector-label span"));
toggle($(".buttons"), true); could be within the if-block because it needs to run only once imo. The jQuery example before had it outside the if-block (that way it's disabling the checkbox, initializing the tooltip and showing the buttons on each button press), maybe there is a reason to have it that way. Maybe to make use of es6, one could replace the event handling Anyways, tested it and lgtm. 👍 |
I actually got rid of the toggle function and used our utility classes, please check one more time. https://codepen.io/team/bootstrap/pen/e1ebd72cfda6962c984dfd274e39658f?editors=1010 The CodePen doesn't need to be perfect, it should just be a good demo :) |
Makes sense. You could use it like that too, // Demo-related
function updateCodeView() {
$('#with-selector-code').classList.toggle('d-none', !usingSelectorOption());
$('#without-selector-code').classList.toggle('d-none', usingSelectorOption());
} but that's up to you. 👍 |
In reference to #28342
As requested by @Johann-S - Updated the codepen example in the popovers.md and tooltips.md