Scoll to the recipe card after selecting a recipe on mobile devices (closes #547)

This commit is contained in:
Bernd Bestel 2020-02-09 15:11:38 +01:00
parent 06fe308f31
commit 3af5bd8e29
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 11 additions and 1 deletions

View File

@ -9,6 +9,7 @@
### Recipe improvements/fixes
- Optimized the ordering of the inputs on the recipe ingredient edit page (moved "Only check if a single unit is in stock" before the amount)
- Variable ingredient amounts are now marked accordingly on the renedered recipe
- After selecting a recipe on mobile devices, the page now automatically scrolls to the recipe card
- Fixed that when editing a recipe ingredient which had "Only check if a single unit is in stock" set, not any quantity unit could be picked and the amount stayed empty
- Fixed that when reloading the "new recipe"-page (or when it gets auto-reloaded due to "Auto reload on external changes" is enabled), for each reload a new recipe was created
- Fixed that the recipe "fullscreen card" was not correctly displayed

View File

@ -26,7 +26,16 @@ if (typeof recipe !== "undefined")
var cardId = "#recipe-card-" + recipe;
$(cardId).addClass("bg-primary").addClass("text-white");
$(cardId)[0].scrollIntoView();
if ($(window).width() < 768)
{
// Scroll to recipe card on mobile
$("#selectedRecipeCard")[0].scrollIntoView();
}
else
{
$(cardId)[0].scrollIntoView();
}
}
if (GetUriParam("search") !== undefined)