<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%@ include file="/info_bar/init.jsp" %>

			</div>

			<c:if test="<%= Validator.isNotNull(buttons) %>">
				<div class="management-bar-header-right">
					<%= buttons %>
				</div>
			</c:if>
		</div>
	</div>
</div>

<c:if test="<%= fixed %>">
	<aui:script sandbox="<%= true %>">
		const element = document.querySelector('.info-bar-container');

		let lastPosition;
		let topOffset = 15;

		function checkPosition() {
			let newPosition = 'affix';

			if (document.defaultView.pageYOffset <= topOffset) {
				newPosition = 'affix-top';
			}

			if (element && newPosition !== lastPosition) {
				element.classList.add(newPosition);
				element.classList.remove(lastPosition);

				lastPosition = newPosition;
			}
		}

		checkPosition();

		document.addEventListener('scroll', checkPosition);

		Liferay.once('destroyPortlet', () => {
			document.removeEventListener('scroll', checkPosition);
		});
	</aui:script>
</c:if>