diff --git a/dist/bootstrap-native.js b/dist/bootstrap-native.js index 9b4af972..a2a3556d 100644 --- a/dist/bootstrap-native.js +++ b/dist/bootstrap-native.js @@ -239,9 +239,9 @@ x : global.pageXOffset || doc[scrollLeft] } }, - styleTip = function(link,element,position,container) { // both popovers and tooltips - var rect = link[getBoundingClientRect](), - scroll = container === body ? getScroll() : { x: container[offsetLeft] + container[scrollLeft], y: container[offsetTop] + container[scrollTop] }, + styleTip = function(link,element,position,container) { // both popovers and tooltips + var rect = link[getBoundingClientRect](), + scroll = container === body ? getScroll() : { x: container[offsetLeft] + container[scrollLeft], y: container[offsetTop] + container[scrollTop] }, linkDimensions = { w: rect[right] - rect[left], h: rect[bottom] - rect[top] }, elementDimensions = { w : element[offsetWidth], h: element[offsetHeight] }; diff --git a/index.html b/index.html index c11980d9..3b2f5cbe 100644 --- a/index.html +++ b/index.html @@ -288,43 +288,45 @@
Bootstrap 4 will remove the remote
option and we already replaced it with a better option. We also skipped the show
option because via JavaScript we quickly and easily access
the component's public methods right after initialiation, we'll have a look in a minute.
Name | -type | -default | -description | -
---|---|---|---|
backdrop |
- boolean or the string 'static' |
- true | -Includes a modal-backdrop element. Alternatively, specify 'static' for a backdrop which doesn't close the modal on click. |
-
keyboard |
- boolean | -true | -Option to dismiss the current modal via Esc key. | -
duration |
- number | -300 | -If you are customizing the animation duration for Modal, you need to provide a duration value via JavaScript or data-duration="DURATION" attribute, an option to
- make sure everything is in sync. |
-
content |
- markup | -- | The Modal component comes with a template system instead of a load remote content function (Bootstrap 4 drops it). This option can be used with JavaScript only. | -
Name | +type | +default | +description | +
---|---|---|---|
backdrop |
+ boolean or the string 'static' |
+ true | +Includes a modal-backdrop element. Alternatively, specify 'static' for a backdrop which doesn't close the modal on click. |
+
keyboard |
+ boolean | +true | +Option to dismiss the current modal via Esc key. | +
duration |
+ number | +300 | +If you are customizing the animation duration for Modal, you need to provide a duration value via JavaScript or data-duration="DURATION" attribute, an option to
+ make sure everything is in sync. |
+
content |
+ markup | ++ | The Modal component comes with a template system instead of a load remote content function (Bootstrap 4 drops it). This option can be used with JavaScript only. | +
The default options' values are same as their jQuery plugin equivalents so you can expect same behavior.
Event Type | Description | ||
---|---|---|---|
show.bs.modal |
This event fires immediately when the .show() instance method is called. If caused by a click and the clicked element is a modal triggering element, that element is available
@@ -383,8 +386,9 @@ Events | hidden.bs.modal |
This event is fired when the modal has finished being hidden from the user (set by our duration option). |
The loaded.bs.modal
original event is not needed, also because we replaced the remote
option with another one. If modal is opened via JavaScript methods, or by clicking
on another element that is not a modal triggering element, the relatedTarget
is null.
The component also allows you to close the dropdown by pressing the Esc key and grants access to methods and original events.
Name | -type | -default | -description | -
---|---|---|---|
persist |
- boolean | -false | -Option to keep the dropdown-menu open when click event targets a child element, useful for forms or interactive content. |
-
Name | +type | +default | +description | +
---|---|---|---|
persist |
+ boolean | +false | +Option to keep the dropdown-menu open when click event targets a child element, useful for forms or interactive content. |
+
Just like the original jQuery plugin, the Dropdown component covers this part as well:
-Event Type | Description | ||
---|---|---|---|
show.bs.dropdown |
This event fires immediately when the show instance method is called. | @@ -815,8 +822,9 @@hidden.bs.dropdown |
This event is fired when the dropdown has finished being hidden from the user. |
The target of all component events is the parent <div class="dropdown">
, while the event.relatedTarget
is the triggering element with the specific
data-toggle="dropdown"
attribute. If you dismiss the dropdown via JavaScript, the Esc key or by clicking outside the triggering button, the event.relatedTarget
is null.
Unlike the original jQuery plugin, this component requires no option for offset
, the default value works just fine.
Name | -type | -default | -description | -
---|---|---|---|
target |
- string or a reference |
- element '#ID' - or other reference - |
- The only option for ScrollSpy, is the target of the container with data-spy="scroll" attribute.EG: data-target="#myMenuID" |
-
Name | +type | +default | +description | +
---|---|---|---|
target |
+ string or a reference |
+ element '#ID' + or other reference + |
+ The only option for ScrollSpy, is the target of the container with data-spy="scroll" attribute.EG: data-target="#myMenuID" |
+
We will talk later about why we don't need an offset
option.
Event Type | -Description | -
---|---|
activate.bs.scrollspy |
- This event fires whenever a new item was activated by the component. | -
Event Type | +Description | +
---|---|
activate.bs.scrollspy |
+ This event fires whenever a new item was activated by the component. | +
The event target is the element we initialized the component via JavaScript or the data-spy="scroll"
attribute. The newly activated menu item's link is the event.relatedTarget
for the event.
Name | -type | -default | -description | -
---|---|---|---|
duration |
- number | -150 | -An internal timing setting to emulate transitionend measured in miliseconds.When using a CSS3 animation duration other than the default value, set the option via JavaScript or - the data-duration="DURATION" attribute. |
-
height |
- boolean | -false | -Option to enable animation of the height of the .tab-content tabs container. Can be set via JavaScript or the data-height="true" attribute. |
-
Name | +type | +default | +description | +
---|---|---|---|
duration |
+ number | +150 | +An internal timing setting to emulate transitionend measured in miliseconds.When using a CSS3 animation duration other than the default value, set the option via JavaScript or + the data-duration="DURATION" attribute. |
+
height |
+ boolean | +false | +Option to enable animation of the height of the .tab-content tabs container. Can be set via JavaScript or the data-height="true" attribute. |
+
When you set the second option to true
, the duration
option is much more important as it will prevent any kind of animation inconsistency. This functionality assumes you are using
the styling of the Collapse component, which means that the duration
must be set according to the transition-duration
style rule of the Collapse component.
Both the above options have no effect on legacy browsers with no support for CSS3 transitions.
@@ -1336,35 +1350,37 @@The component events will fire in the exact order shown in table below:
-Event Type | -Description | -
---|---|
hide.bs.tab |
- This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). The event.target is the current active tab, while event.relatedTarget
- is the new soon-to-be-active tab. |
-
show.bs.tab |
- This event fires on tab show, but before the new tab has been shown. The event.target is the tab next to become active and event.relatedTarget is the current
- active tab (if available). |
-
hidden.bs.tab |
- This event fires after a new tab is shown (and thus the previous active tab is hidden). The event.target is the tab that just became inactive and event.relatedTarget
- is the new active tab. |
-
shown.bs.tab |
- This event fires on tab show after a tab has been shown. The event.target is the new active tab and event.relatedTarget is the previous active tab (if available). |
-
Event Type | +Description | +
---|---|
hide.bs.tab |
+ This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). The event.target is the current active tab, while event.relatedTarget
+ is the new soon-to-be-active tab. |
+
show.bs.tab |
+ This event fires on tab show, but before the new tab has been shown. The event.target is the tab next to become active and event.relatedTarget is the current
+ active tab (if available). |
+
hidden.bs.tab |
+ This event fires after a new tab is shown (and thus the previous active tab is hidden). The event.target is the tab that just became inactive and event.relatedTarget
+ is the new active tab. |
+
shown.bs.tab |
+ This event fires on tab show after a tab has been shown. The event.target is the new active tab and event.relatedTarget is the previous active tab (if available). |
+
The component covers most important options, excluding some of the options featured in the original jQuery plugin such as a template system needed template
option, a selector
option for auto-initialization, or a trigger
option. The component works different but has it's own advantages.
Name | -type | -default | -description | -
---|---|---|---|
animation |
- string | -fade | -Option to customize the component animation. If you are using a different animation other than fade , you can specify that via the data-animation="ANIMATION" attribute.
- This will add an additional CSS class to the tooltip to enable a custom transition. |
-
placement |
- string | -top | -Option to set a specific placement to top , bottom , left or right , relative to it's target. Can be set via both JavaScript and the
- data-placement="POSITION" attribute. |
-
duration |
- number | -150 | -An internal timing setting to emulate transitionend measured in miliseconds. When using a CSS3 animation duration other than the default value, set the option via JavaScript
- or the data-duration="DURATION" attribute. |
-
delay |
- number | -100 | -A short delay before hiding the tooltip. Can be set via JavaScript or the data-delay="DELAY" attribute. |
-
container |
- selector or object |
- <document.body> |
- The container where your popovers get appended to. You can set the option via the data-container="#elementID" attribute or via JavaScript. |
-
Name | +type | +default | +description | +
---|---|---|---|
animation |
+ string | +fade | +Option to customize the component animation. If you are using a different animation other than fade , you can specify that via the data-animation="ANIMATION" attribute.
+ This will add an additional CSS class to the tooltip to enable a custom transition. |
+
placement |
+ string | +top | +Option to set a specific placement to top , bottom , left or right , relative to it's target. Can be set via both JavaScript and the
+ data-placement="POSITION" attribute. |
+
duration |
+ number | +150 | +An internal timing setting to emulate transitionend measured in miliseconds. When using a CSS3 animation duration other than the default value, set the option via JavaScript
+ or the data-duration="DURATION" attribute. |
+
delay |
+ number | +100 | +A short delay before hiding the tooltip. Can be set via JavaScript or the data-delay="DELAY" attribute. |
+
container |
+ selector or object |
+ <body> |
+ The container where your tooltips get appended to. You can set the option via JavaScript or the data-container="#elementID" attribute. |
+
The component's original events are same as with the original jQuery Plugin, except inserted.bs.tooltip
, the way the component works makes that this event is not needed, as it would fire
on every instance of the .show()
method.
Event Type | -Description | -
---|---|
show.bs.tooltip |
- This event fires immediately when the show instance method is called. |
-
shown.bs.tooltip |
- This event is fired when the tooltip has been made visible to the user (set by the duration option). |
-
hide.bs.tooltip |
- This event is fired immediately when the hide instance method has been called. |
-
hidden.bs.tooltip |
- This event is fired when the tooltip has finished being hidden from the user (set by the duration option). |
-
Event Type | +Description | +
---|---|
show.bs.tooltip |
+ This event fires immediately when the show instance method is called. |
+
shown.bs.tooltip |
+ This event is fired when the tooltip has been made visible to the user (set by the duration option). |
+
hide.bs.tooltip |
+ This event is fired immediately when the hide instance method has been called. |
+
hidden.bs.tooltip |
+ This event is fired when the tooltip has finished being hidden from the user (set by the duration option). |
+
The component covers all needed options, including those for a template system:
-Name | -type | -default | -description | -
---|---|---|---|
template |
- markup | -- | Option to use a custom HTML template via JavaScript only for your popovers. See examples below for info. | -
content |
- markup | -- | Option to set the content of the popover via JavaScript or the data-content="CONTENT" attribute. |
-
title |
- markup | -- | Option to set the title of the popover via JavaScript or the data-title="TITLE" attribute. |
-
dismissible |
- boolean | -false | -Option to option to make the popover dismissible. When true, it will also add an X button at the top-right of the popover. You can enable this option via
- data-dismissible="true" attribute. |
-
trigger |
- string | -hover | -Option to change the component's action trigger event: hover, focus and click. In some cases you may want to open a popover on focus
- for form elements or click for other buttons, you can specify that via JavaScript or the data-trigger="EVENT" attribute. |
-
animation |
- string | -fade | -Option to customize the component animation. If you are using a different animation other than fade , you can specify that via the data-animation="ANIMATION"
- attribute. This will add an additional CSS class to the popover to enable a custom transition. |
-
placement |
- string | -top | -Option to set a specific placement to top , bottom , left or right , relative to it's target. Can be set via both JavaScript and the
- data-placement="POSITION" attribute. |
-
duration |
- number | -150 | -An internal timing setting to emulate transitionend measured in miliseconds. When using a CSS3 animation duration other than the default value, set the option via
- JavaScript or the data-duration="DURATION" attribute. |
-
delay |
- number | -100 | -A short delay before hiding the popover. Can be set via JavaScript or the data-delay="DELAY" attribute. |
-
container |
- selector or object |
- <document.body> |
- The container where your popovers get appended to. You can set the option via the data-container="#elementID" attribute or via JavaScript. |
-
Name | +type | +default | +description | +
---|---|---|---|
template |
+ markup | ++ | Option to use a custom HTML template via JavaScript only for your popovers. See examples below for info. | +
content |
+ markup | ++ | Option to set the content of the popover via JavaScript or the data-content="CONTENT" attribute. |
+
title |
+ markup | ++ | Option to set the title of the popover via JavaScript or the data-title="TITLE" attribute. |
+
dismissible |
+ boolean | +false | +Option to option to make the popover dismissible. When true, it will also add an X button at the top-right of the popover. You can enable this option via
+ data-dismissible="true" attribute. |
+
trigger |
+ string | +hover | +Option to change the component's action trigger event: hover, focus and click. In some cases you may want to open a popover on focus
+ for form elements or click for other buttons, you can specify that via JavaScript or the data-trigger="EVENT" attribute. |
+
animation |
+ string | +fade | +Option to customize the component animation. If you are using a different animation other than fade , you can specify that via the data-animation="ANIMATION"
+ attribute. This will add an additional CSS class to the popover to enable a custom transition. |
+
placement |
+ string | +top | +Option to set a specific placement to top , bottom , left or right , relative to it's target. Can be set via both JavaScript and the
+ data-placement="POSITION" attribute. |
+
duration |
+ number | +150 | +An internal timing setting to emulate transitionend measured in miliseconds. When using a CSS3 animation duration other than the default value, set the option via
+ JavaScript or the data-duration="DURATION" attribute. |
+
delay |
+ number | +100 | +A short delay before hiding the popover. Can be set via JavaScript or the data-delay="DELAY" attribute. |
+
container |
+ selector or object |
+ <body> |
+ The container where your popovers get appended to. You can set the option via JavaScript or the data-container="#elementID" attribute. |
+
If a proper template is not specified via JavaScript or the content option is not set in any way, the Popover will not be initialized.
The component's original events are same as with the original jQuery Plugin, except inserted.bs.popover
, just as explained for the Tooltip component.
Event Type | -Description | -
---|---|
show.bs.popover |
- This event fires immediately when the show instance method is called. |
-
shown.bs.popover |
- This event is fired when the popover has been made visible to the user (set by the duration option). |
-
hide.bs.popover |
- This event is fired immediately when the hide instance method has been called. |
-
hidden.bs.popover |
- This event is fired when the popover has finished being hidden from the user (set by the duration option). |
-
Event Type | +Description | +
---|---|
show.bs.popover |
+ This event fires immediately when the show instance method is called. |
+
shown.bs.popover |
+ This event is fired when the popover has been made visible to the user (set by the duration option). |
+
hide.bs.popover |
+ This event is fired immediately when the hide instance method has been called. |
+
hidden.bs.popover |
+ This event is fired when the popover has finished being hidden from the user (set by the duration option). |
+
The component's original events are same as with the original jQuery Plugin.
-Event Type | -Description | -
---|---|
close.bs.alert |
- This event is fired immediately when the close instance method has been called. |
-
closed.bs.alert |
- This event is fired when the alert has finished being hidden from the user. | -
Event Type | +Description | +
---|---|
close.bs.alert |
+ This event is fired immediately when the close instance method has been called. |
+
closed.bs.alert |
+ This event is fired when the alert has finished being hidden from the user. | +
Button doesn't cover single toggle feature. The supported toggle feature could very much fill the same purpose.