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

Check if bootstrap exists #678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Havit.Blazor.Components.Web.Bootstrap/wwwroot/HxPopover.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// has to be aligned with HxTooltip.js!
export function initialize(element, hxDotnetObjectReference, options) {
if (!element) {
if (!bootstrap || !element) {
return;
}
element.hxDotnetObjectReference = hxDotnetObjectReference;
Expand All @@ -10,20 +10,29 @@ export function initialize(element, hxDotnetObjectReference, options) {
}

export function show(element) {
if (!bootstrap) {
return;
}
var i = bootstrap.Popover.getInstance(element);
if (i) {
i.show();
}
}

export function hide(element) {
if (!bootstrap) {
return;
}
var i = bootstrap.Popover.getInstance(element);
if (i) {
i.hide();
}
}

export function enable(element) {
if (!bootstrap) {
return;
}
var i = bootstrap.Popover.getInstance(element);
if (i) {
i.enable();
Expand All @@ -32,6 +41,9 @@ export function enable(element) {
}

export function disable(element) {
if (!bootstrap) {
return;
}
var i = bootstrap.Popover.getInstance(element);
if (i) {
i.disable();
Expand All @@ -40,6 +52,9 @@ export function disable(element) {
}

export function setContent(element, newContent) {
if (!bootstrap) {
return;
}
var i = bootstrap.Popover.getInstance(element);
if (i) {
i.setContent(newContent);
Expand All @@ -55,7 +70,7 @@ function handleHidden(event) {
};

export function dispose(element) {
if (!element) {
if (!bootstrap || !element) {
return;
}
element.removeEventListener('shown.bs.popover', handleShown);
Expand Down