[ticket/11979] Add ability to create dropdown menu to prosilver

PHPBB3-11979
This commit is contained in:
Vjacheslav Trushkin 2013-10-27 11:36:19 +02:00
parent 52845b22f2
commit 6b39f3b6a7
2 changed files with 53 additions and 5 deletions

View file

@ -433,6 +433,39 @@ function parse_document(container)
jumpto($(this)); jumpto($(this));
}); });
/**
* Dropdowns
*/
container.find('.dropdown-container').each(function() {
var $this = $(this),
trigger = $this.find('.dropdown-trigger:first'),
contents = $this.find('.dropdown'),
options = {
direction: 'auto',
verticalDirection: 'auto'
},
data;
if (!trigger.length) {
data = $this.attr('data-dropdown-trigger');
trigger = data ? $this.children(data) : $this.children('a:first');
}
if (!contents.length) {
data = $this.attr('data-dropdown-contents');
contents = data ? $this.children(data) : $this.children('div:first');
}
if (!trigger.length || !contents.length) return;
if ($this.hasClass('dropdown-up')) options.verticalDirection = 'up';
if ($this.hasClass('dropdown-down')) options.verticalDirection = 'down';
if ($this.hasClass('dropdown-left')) options.verticalDirection = 'left';
if ($this.hasClass('dropdown-right')) options.verticalDirection = 'right';
phpbb.registerDropdown(trigger, contents, options);
});
/** /**
* Adjust HTML code for IE8 and older versions * Adjust HTML code for IE8 and older versions
*/ */

View file

@ -407,6 +407,14 @@ li.responsive-menu .dropdown .dropdown-contents {
padding: 0 5px; padding: 0 5px;
} }
ul.linklist .dropdown-down .dropdown {
top: 22px;
}
ul.linklist .dropdown-up .dropdown {
bottom: 18px;
}
ul.linklist .dropdown li { ul.linklist .dropdown li {
clear: both; clear: both;
} }
@ -437,10 +445,18 @@ ul.linklist.bulletin li.no-bulletin:before {
/* Dropdown menu /* Dropdown menu
----------------------------------------*/ ----------------------------------------*/
.dropdown-container {
position: relative;
}
.nojs .dropdown-container:hover .dropdown {
display: block !important;
}
.dropdown { .dropdown {
position: absolute; position: absolute;
left: 0; left: 0;
top: 22px; top: 1.2em;
z-index: 2; z-index: 2;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 5px; border-radius: 5px;
@ -449,16 +465,15 @@ ul.linklist.bulletin li.no-bulletin:before {
.dropdown-up .dropdown { .dropdown-up .dropdown {
top: auto; top: auto;
bottom: 18px; bottom: 1.2em;
padding: 0 0 9px; padding: 0 0 9px;
} }
.dropdown-left .dropdown { .dropdown-left .dropdown, .nojs .rightside .dropdown {
left: auto; left: auto;
right: 0; right: 0;
} }
.dropdown .pointer, .dropdown .pointer-inner { .dropdown .pointer, .dropdown .pointer-inner {
position: absolute; position: absolute;
width: 0; width: 0;
@ -488,7 +503,7 @@ ul.linklist.bulletin li.no-bulletin:before {
top: auto; top: auto;
} }
.dropdown-left .dropdown .pointer { .dropdown-left .dropdown .pointer, .nojs .rightside .dropdown .pointer {
left: auto; left: auto;
right: 10px; right: 10px;
} }