diff --git a/public/build/beike/shop/default/css/app.css b/public/build/beike/shop/default/css/app.css index be0eca1b..bd7cff8e 100644 --- a/public/build/beike/shop/default/css/app.css +++ b/public/build/beike/shop/default/css/app.css @@ -465,6 +465,24 @@ header .navbar-icon-link-badge { line-height: 19px; } +#offcanvas-search-top { + height: 100px; + justify-content: center; +} +#offcanvas-search-top .offcanvas-header { + width: 100%; +} +#offcanvas-search-top input:focus { + box-shadow: none; +} +#offcanvas-search-top .btn-close { + padding: 1rem; + opacity: 1; +} +#offcanvas-search-top .btn-close:hover { + background-color: #eee; +} + #offcanvas-right-cart .offcanvas-right-products .product-list { padding: 1rem 0; border-top: 1px solid #eee; diff --git a/public/build/beike/shop/default/js/app.js b/public/build/beike/shop/default/js/app.js index 28922afa..b3b32e67 100644 --- a/public/build/beike/shop/default/js/app.js +++ b/public/build/beike/shop/default/js/app.js @@ -2545,17 +2545,21 @@ $(document).ready(function ($) { } else { $('.total-old').remove(); $('.fixed-top-line').removeAttr('style'); - } // if ($(this).scrollTop() > totalWrapTop) { - // $('.fixed-top-line').addClass('fixed-top-line-fixed').css({'left': totalWrapLeft, 'width': totalWrapWidth}) - // if ($('.total-old').length > 0) return; - // $('.fixed-top-line').before('
'); - // } else { - // $('.total-old').remove(); - // $('.fixed-top-line').removeClass('fixed-top-line-fixed').css({'left': 0, 'width': 'auto'}) - // } - + } }); - })(window.jQuery); + })(window.jQuery); // offcanvas-search-top + + + var myOffcanvas = document.getElementById('offcanvas-search-top'); + myOffcanvas.addEventListener('shown.bs.offcanvas', function () { + $('#offcanvas-search-top input').focus(); + $('#offcanvas-search-top input').keydown(function (e) { + if (e.keyCode == 13) { + console.log('enter'); + $('#offcanvas-search-top .btn-search').click(); + } + }); + }); }); bk.getCarts = function () { diff --git a/resources/beike/shop/default/css/header.scss b/resources/beike/shop/default/css/header.scss index dd1a7ed4..626a7312 100644 --- a/resources/beike/shop/default/css/header.scss +++ b/resources/beike/shop/default/css/header.scss @@ -90,6 +90,30 @@ header { } } +#offcanvas-search-top { + height: 100px; + justify-content: center; + + .offcanvas-header { + width: 100%; + } + + input { + &:focus { + box-shadow: none; + } + } + + .btn-close { + padding: 1rem; + opacity: 1; + + &:hover { + background-color: #eee; + } + } +} + #offcanvas-right-cart { .offcanvas-right-products { .product-list { diff --git a/resources/beike/shop/default/js/app.js b/resources/beike/shop/default/js/app.js index 2a97eec7..32b234a5 100644 --- a/resources/beike/shop/default/js/app.js +++ b/resources/beike/shop/default/js/app.js @@ -65,18 +65,20 @@ $(document).ready(function ($) { $('.total-old').remove(); $('.fixed-top-line').removeAttr('style') } - - - // if ($(this).scrollTop() > totalWrapTop) { - // $('.fixed-top-line').addClass('fixed-top-line-fixed').css({'left': totalWrapLeft, 'width': totalWrapWidth}) - // if ($('.total-old').length > 0) return; - // $('.fixed-top-line').before(''); - // } else { - // $('.total-old').remove(); - // $('.fixed-top-line').removeClass('fixed-top-line-fixed').css({'left': 0, 'width': 'auto'}) - // } }) })(window.jQuery); + + // offcanvas-search-top + var myOffcanvas = document.getElementById('offcanvas-search-top') + myOffcanvas.addEventListener('shown.bs.offcanvas', function () { + $('#offcanvas-search-top input').focus(); + $('#offcanvas-search-top input').keydown(function (e) { + if (e.keyCode == 13) { + console.log('enter'); + $('#offcanvas-search-top .btn-search').click(); + } + }) + }) }); bk.getCarts = function () { diff --git a/themes/default/layout/header.blade.php b/themes/default/layout/header.blade.php index 709b6e93..67113fb0 100644 --- a/themes/default/layout/header.blade.php +++ b/themes/default/layout/header.blade.php @@ -63,7 +63,7 @@