testing new function for centering datepicker in mobile view for off canvas booking...
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 28 Jul 2016 19:06:46 +0000 (15:06 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 28 Jul 2016 19:06:46 +0000 (15:06 -0400)
js/app.js
js/custom/pageSetup.js

index edb9b75..43b3165 100644 (file)
--- 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 () {
index d3dd73c..6193d90 100644 (file)
@@ -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 () {