This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

phplee
phplee

Im using ajax in quite a few plugin now and notice a major drawback.

For example: If you have an ajax form which once submitted displays a 'Thank you for your submission' message in place of where the form was via the on update etc. On a mobile device the message never get seen by the user because its out of view because the page doesn't refresh. Noticed this recently on the JKShop basket/checkout if you click back/continue etc.

So my question is. Is there a way after a ajax call / update to have the screen scroll to an anchor maybe or the #id of the element thats been update so that the result is in view on screen. that way on a mobile device the user would miss the updated content.

Hope this make sense an any help would be great.

thank

alxy
alxy

Sure this is possible. There are some global events beeing emited after an AJAX call. Make sure to check them out and if necessary, listen to one and execute some javascript to scroll to an appropriate location.

phplee
phplee

thanks!

Sorry to be a pain but could you give me a simple example. lets say an javascript alert was shown after the ajax was updated.

thanks again

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.