|
|
@@ -1,57 +1,46 @@
|
|
|
-
|
|
|
-jQuery(document).ready(function($) {
|
|
|
-
|
|
|
- $(window).bind('load', function() {
|
|
|
- $('#loader').fadeOut(100);
|
|
|
- });
|
|
|
-
|
|
|
- $('.nav-toggle').on('touchstart click', function(e) {
|
|
|
- e.preventDefault();
|
|
|
- $( this ).toggleClass( 'active' );
|
|
|
- });
|
|
|
-
|
|
|
- $(function dw_hidenav() {
|
|
|
- var headerHeight = $('.navbar').height();
|
|
|
- $(window).on('scroll', { previousTop: 0 },
|
|
|
- function() {
|
|
|
- var currentTop = $(window).scrollTop();
|
|
|
- if (currentTop < this.previousTop) {
|
|
|
- if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
|
|
|
- $('.navbar').addClass('visible');
|
|
|
- $('.site-title a').removeClass('light');
|
|
|
- } else {
|
|
|
- $('.navbar').removeClass('visible fixed');
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- $('.navbar').removeClass('visible');
|
|
|
- if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
|
|
|
- }
|
|
|
- this.previousTop = currentTop;
|
|
|
- }
|
|
|
- );
|
|
|
- });
|
|
|
-
|
|
|
- $('#gallery').carousel({
|
|
|
- interval: 5000,
|
|
|
- wrap: true,
|
|
|
- });
|
|
|
-
|
|
|
- $(document).bind('keyup', function(e) {
|
|
|
- if(e.which === 39){
|
|
|
- $('#gallery').carousel('next');
|
|
|
- }
|
|
|
- else if(e.which === 37){
|
|
|
- $('#gallery').carousel('prev');
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- $('.prev').click(function() {
|
|
|
- $('#gallery').carousel('prev');
|
|
|
- });
|
|
|
-
|
|
|
- $('.next').click(function() {
|
|
|
- $('#gallery').carousel('next');
|
|
|
- });
|
|
|
-
|
|
|
-});
|
|
|
+// Art page — vanilla JS (no jQuery, no Bootstrap carousel).
|
|
|
+
|
|
|
+// Navbar hide/show on scroll (ported from the shared jQuery dw_hidenav).
|
|
|
+(function () {
|
|
|
+ const navbar = document.querySelector('.navbar');
|
|
|
+ if (!navbar) return;
|
|
|
+ const title = document.querySelector('.site-title a');
|
|
|
+ const headerHeight = navbar.offsetHeight;
|
|
|
+ let previousTop = 0;
|
|
|
+ window.addEventListener('scroll', function () {
|
|
|
+ const currentTop = window.scrollY;
|
|
|
+ if (currentTop < previousTop) {
|
|
|
+ if (currentTop > 0 && navbar.classList.contains('fixed')) {
|
|
|
+ navbar.classList.add('visible');
|
|
|
+ if (title) title.classList.remove('light');
|
|
|
+ } else {
|
|
|
+ navbar.classList.remove('visible', 'fixed');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ navbar.classList.remove('visible');
|
|
|
+ if (currentTop > headerHeight && !navbar.classList.contains('fixed')) {
|
|
|
+ navbar.classList.add('fixed');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ previousTop = currentTop;
|
|
|
+ }, { passive: true });
|
|
|
+})();
|
|
|
+
|
|
|
+// Gallery — scroll-snap prev/next buttons + arrow keys (replaces the BS carousel).
|
|
|
+(function () {
|
|
|
+ const track = document.querySelector('.dw-carousel-track');
|
|
|
+ if (!track) return;
|
|
|
+ const step = () =>
|
|
|
+ track.firstElementChild
|
|
|
+ ? track.firstElementChild.getBoundingClientRect().width
|
|
|
+ : track.clientWidth;
|
|
|
+ const scroll = (dir) => track.scrollBy({ left: dir * step(), behavior: 'smooth' });
|
|
|
+ const prev = document.querySelector('.dw-carousel-prev');
|
|
|
+ const next = document.querySelector('.dw-carousel-next');
|
|
|
+ if (prev) prev.addEventListener('click', () => scroll(-1));
|
|
|
+ if (next) next.addEventListener('click', () => scroll(1));
|
|
|
+ document.addEventListener('keydown', function (e) {
|
|
|
+ if (e.key === 'ArrowRight') scroll(1);
|
|
|
+ else if (e.key === 'ArrowLeft') scroll(-1);
|
|
|
+ });
|
|
|
+})();
|