Last active
June 5, 2021 20:06
-
-
Save Mons1eurEnzo/af51d2663cbec5ea9143451725f24552 to your computer and use it in GitHub Desktop.
Bitrix Panel fixed (Фиксим плавающую панель сайта и панель админки Битрикса)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BX.ready(function () { | |
var MyPanel = BX("navmenu"), // ID ShowPanel Bitrix | |
BxPanel = BX.admin.panel, | |
FxPanel = function () { | |
if (window.pageYOffset >= BxPanel.DIV.clientHeight && BxPanel.isFixed() === false) { | |
MyPanel.style.top = 0; | |
} else if (BxPanel.isFixed() === true) { | |
MyPanel.style.top = BxPanel.DIV.clientHeight + "px"; | |
} else { | |
MyPanel.style.top = BxPanel.DIV.clientHeight - window.pageYOffset + "px"; | |
} | |
}; | |
if (!!MyPanel) { | |
FxPanel(); | |
window.onscroll = FxPanel; | |
BX.addCustomEvent('onTopPanelCollapse', BX.delegate(FxPanel, this)); | |
BX.addCustomEvent('onTopPanelFix', BX.delegate(FxPanel, this)); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?if($GLOBALS["USER"]->IsAuthorized()):?> | |
<?$APPLICATION->ShowPanel();?> | |
<script>/*/ --- сюда вставляем JS код --- //*/</script> | |
<?endif;?> |
Спасибо, очень полезно. А есть способ прилеппить меню? Сейчас меню ездит плавно и отвлекает на себя внимание.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Возможно будет полезно тем, кто как и я нашел этот фикс)
После строки 15 добавьте еще один обработчик:
window.onload = FxPanel;