From bd4f899268dfb4aa1dbfa7bfcb3dcc650b438677 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Thu, 9 Jan 2020 15:18:56 +0700 Subject: [PATCH] Fix scroll on mobile device --- assets/js/opalestate.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/assets/js/opalestate.js b/assets/js/opalestate.js index 7ed5b370..95eda7e8 100755 --- a/assets/js/opalestate.js +++ b/assets/js/opalestate.js @@ -220,7 +220,31 @@ jQuery( document ).ready( function ( $ ) { } ); // sticky //// - $( '.opalestate-sticky-column' ).stick_in_parent(); + // $( '.opalestate-sticky-column' ).stick_in_parent(); + + var window_width = $( window ).width(); + + if (window_width < 768) { + $(".opalestate-sticky-column").trigger("sticky_kit:detach"); + } else { + make_sticky(); + } + + $( window ).resize(function() { + + window_width = $( window ).width(); + + if (window_width < 768) { + $(".opalestate-sticky-column").trigger("sticky_kit:detach"); + } else { + make_sticky(); + } + + }); + + function make_sticky() { + $(".opalestate-sticky-column").stick_in_parent(); + } //// $( '.input-group-number' ).each( function () {