[Toolbar] Handle info position via javascript
Place info div to not float out of the window
This commit is contained in:
parent
7a8582e1f6
commit
23c0ddca39
@ -139,10 +139,6 @@
|
|||||||
border-radius: 4px 4px 0 0;
|
border-radius: 4px 4px 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sf-toolbarreset > div:last-of-type .sf-toolbar-info {
|
|
||||||
right: -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sf-toolbar-block .sf-toolbar-info:empty {
|
.sf-toolbar-block .sf-toolbar-info:empty {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Sfjs.renderAjaxRequests();
|
Sfjs.renderAjaxRequests();
|
||||||
|
|
||||||
|
/* Handle toolbar-info position */
|
||||||
|
var toolbarBlocks = document.getElementsByClassName('sf-toolbar-block');
|
||||||
|
for (var i = 0; i < toolbarBlocks.length; i += 1) {
|
||||||
|
toolbarBlocks[i].onmouseover = function () {
|
||||||
|
var toolbarInfo = this.getElementsByClassName('sf-toolbar-info')[0];
|
||||||
|
var pageWidth = document.body.clientWidth;
|
||||||
|
var elementWidth = toolbarInfo.offsetWidth;
|
||||||
|
var leftValue = (elementWidth + this.offsetLeft) - pageWidth;
|
||||||
|
var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth;
|
||||||
|
|
||||||
|
if (leftValue > 0 && rightValue > 0) {
|
||||||
|
toolbarInfo.style.right = (rightValue * -1) + 'px';
|
||||||
|
} else if (leftValue < 0) {
|
||||||
|
toolbarInfo.style.left = 0;
|
||||||
|
} else {
|
||||||
|
toolbarInfo.style.right = '-1px';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
function(xhr) {
|
function(xhr) {
|
||||||
if (xhr.status !== 0) {
|
if (xhr.status !== 0) {
|
||||||
|
Reference in New Issue
Block a user