diff --git a/assets/javascripts/behaviour.coffee b/assets/javascripts/behaviour.coffee index 88a5c76..f2631d3 100644 --- a/assets/javascripts/behaviour.coffee +++ b/assets/javascripts/behaviour.coffee @@ -2,12 +2,14 @@ $ -> # Scroll to search box on narrow devices $q = $("#q") if $q.length - if $(document).width() <= 2568 + if $(document).width() <= 568 newY = $("#q").offset().top $("body").css("min-height", $(document).height() + newY) $q.focus -> $q.css("font-size", "16px") # hack to prevent iOS from zooming - $(document).scrollTop(newY - 6) + $("html, body").animate + scrollTop: newY - 6 + , 100 else # set focus on field if not a narrow device and if no search field is empty $q.focus() unless $q.val().length