From: Anthony Talarico Date: Thu, 28 Jul 2016 19:06:46 +0000 (-0400) Subject: testing new function for centering datepicker in mobile view for off canvas booking... X-Git-Tag: v1.0.0^2~237 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=ebdd3403ba4aaf91db5a6b97d489d1e37e652b52;p=WP-Themes%2Fpetoskeyarea.git testing new function for centering datepicker in mobile view for off canvas booking widget --- diff --git a/js/app.js b/js/app.js index edb9b75..43b3165 100644 --- a/js/app.js +++ b/js/app.js @@ -66,25 +66,35 @@ $(document).ready(function () { // } // } // }); + var off_canvas_arrival = $(".right-off-canvas-menu").find("#start-date"); var off_canvas_departure = $(".right-off-canvas-menu").find("#end-date"); $(off_canvas_arrival).removeClass("date-pick").removeAttr("onclick").removeAttr("value"); - $(off_canvas_departure).removeClass("date-pick").removeAttr("onclick").removeAttr("value"); - + $(off_canvas_departure).removeClass("date-pick").removeAttr("onclick").removeAttr("value"); + $(off_canvas_arrival).datepicker({ + minDate: 0, - beforeShow: function(input, inst) - { - inst.dpDiv.css({marginTop: -input.offsetHeight + 'px', marginLeft: '-20px'}); - } + beforeShow: function (input, inst) { + setTimeout(function () { + inst.dpDiv.css({ + top: 100, + left: 15 + }); + }, 0); + } }); $(off_canvas_departure).datepicker({ - beforeShow: function(input, inst) - { - inst.dpDiv.css({marginTop: '-10px', marginLeft: '-20px'}); - } + beforeShow: function (input, inst) { + setTimeout(function () { + inst.dpDiv.css({ + top: 100, + left: 15 + }); + }, 0); + } }); $(off_canvas_arrival).change( function () { diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index d3dd73c..6193d90 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -57,25 +57,35 @@ $(document).ready(function () { // } // } // }); + var off_canvas_arrival = $(".right-off-canvas-menu").find("#start-date"); var off_canvas_departure = $(".right-off-canvas-menu").find("#end-date"); $(off_canvas_arrival).removeClass("date-pick").removeAttr("onclick").removeAttr("value"); - $(off_canvas_departure).removeClass("date-pick").removeAttr("onclick").removeAttr("value"); - + $(off_canvas_departure).removeClass("date-pick").removeAttr("onclick").removeAttr("value"); + $(off_canvas_arrival).datepicker({ + minDate: 0, - beforeShow: function(input, inst) - { - inst.dpDiv.css({marginTop: -input.offsetHeight + 'px', marginLeft: '-20px'}); - } + beforeShow: function (input, inst) { + setTimeout(function () { + inst.dpDiv.css({ + top: 100, + left: 15 + }); + }, 0); + } }); $(off_canvas_departure).datepicker({ - beforeShow: function(input, inst) - { - inst.dpDiv.css({marginTop: '-10px', marginLeft: '-20px'}); - } + beforeShow: function (input, inst) { + setTimeout(function () { + inst.dpDiv.css({ + top: 100, + left: 15 + }); + }, 0); + } }); $(off_canvas_arrival).change( function () {