You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2017/06/27 10:59:01 UTC
svn commit: r1800048 -
/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-dropdown.js
Author: hnoeth
Date: Tue Jun 27 10:59:01 2017
New Revision: 1800048
URL: http://svn.apache.org/viewvc?rev=1800048&view=rev
Log:
TOBAGO-1761 Append dropdownmenus to tobago-page-menuStore
* use specific bootstrap events
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-dropdown.js
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-dropdown.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-dropdown.js?rev=1800048&r1=1800047&r2=1800048&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-dropdown.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-dropdown.js Tue Jun 27 10:59:01 2017
@@ -33,28 +33,24 @@ Tobago.Dropdown.init = function (element
var $button = jQuery(Tobago.Utils.escapeClientId($parent.attr('id') + "::command"));
$button.attr('aria-controls', dropdownId);
- $button.on('click', function () {
- if ($dropdownMenu.css("display") === "none") {
- $dropdownMenu.css("display", "block");
- $dropdownMenu.css("top", $button.offset().top + $button.outerHeight() + "px");
+ var showDropdown = function (event) {
+ $dropdownMenu.css("display", "block");
+ $dropdownMenu.css("top", $button.offset().top + $button.outerHeight() + "px");
- if ($dropdownMenu.hasClass("dropdown-menu-right")) {
- $dropdownMenu.css("left", $button.offset().left + $button.outerWidth() - $dropdownMenu.outerWidth() + "px");
- } else {
- $dropdownMenu.css("left", $button.offset().left + "px");
- }
+ if ($dropdownMenu.hasClass("dropdown-menu-right")) {
+ $dropdownMenu.css("left", $button.offset().left + $button.outerWidth() - $dropdownMenu.outerWidth() + "px");
} else {
- $dropdownMenu.css("display", "");
+ $dropdownMenu.css("left", $button.offset().left + "px");
}
- });
+ };
- var closeDropdown = function () {
+ var hideDropdown = function (event) {
if (event && !jQuery.contains($dropdownMenu[0], event.target) && $dropdownMenu.css("display") === "block") {
$dropdownMenu.css("display", "");
}
};
- jQuery(document).on('click.bs.dropdown.data-api focusin.bs.dropdown.data-api', closeDropdown)
- .on('keydown.bs.dropdown.data-api', '[data-toggle="dropdown"]', closeDropdown);
+
+ $parent.on('shown.bs.dropdown', showDropdown).on('hidden.bs.dropdown', hideDropdown);
}
});
};