Skip to content

Commit c8216cc

Browse files
committed
use graduated chrome only fallback for modal fenster height
1 parent 814bc8b commit c8216cc

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

src/Resources/public/js/init_cms.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@ function uploadError(xhr) {
2121
}
2222
(function ($) {
2323

24+
// Opera 8.0+
25+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
26+
27+
// Firefox 1.0+
28+
var isFirefox = typeof InstallTrigger !== 'undefined';
29+
30+
// Safari 3.0+ "[object HTMLElementConstructor]"
31+
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) {
32+
return p.toString() === "[object SafariRemoteNotification]";
33+
})(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
34+
35+
// Internet Explorer 6-11
36+
var isIE = /*@cc_on!@*/false || !!document.documentMode;
37+
38+
// Edge 20+
39+
var isEdge = !isIE && !!window.StyleMedia;
40+
41+
// Chrome 1+
42+
var isChrome = !!window.chrome && !!window.chrome.webstore;
43+
2444
var noticeBlock = $('.notice-block');
2545

2646
noticeBlock.on('DOMNodeInserted', function () {
@@ -40,7 +60,22 @@ function uploadError(xhr) {
4060
$(document).on('shown.bs.modal', '.modal', function (e) {
4161
var modalBody = $(this).find('.modal-body');
4262
modalBody.css('overflow-y', 'auto');
43-
modalBody.css('max-height', '55vh');
63+
modalBody.css('max-height', 'calc(55vh)');
64+
if(isChrome){
65+
var windowHeight = $(window).height();
66+
if(windowHeight > 860){
67+
modalBody.css('max-height', '70vh');
68+
}else if(windowHeight > 740){
69+
modalBody.css('max-height', '65vh');
70+
}else if(windowHeight > 640){
71+
modalBody.css('max-height', '60vh');
72+
}else{
73+
modalBody.css('max-height', '55vh');
74+
}
75+
}else{
76+
modalBody.css('max-height', '70vh');
77+
}
78+
4479
openModals.push($(this).attr('id'));
4580
}).on('hide.bs.modal', '.modal', function(){
4681
var index = openModals.indexOf($(this).attr('id'));

0 commit comments

Comments
 (0)