Hello!
This not work and problem stands inside IW code.
I know 2 options to execute custom JS from CG code after rendering.
- with rramOldMethod: CGAddJavaScriptToAjaxResponse()
- with rramLazyLoad: AAfterLazyLoadJS
Both ways executes custom JS too early, when page is not rendered fully.
Since i use rramOldMethod with CGAddJavaScriptToAjaxResponse, i dived into source and found that you use
IWApp.CallbackResponse.AddJavaScriptToExecute. (you may use AddJavaScriptToExecuteAsCDATA instead of adding tags manually).
So, when this code will be executed is totally depends on IW code.
I tried add "debugger;" JS code and check when it will be executed.
And you know what? Looks like it executes when dom is not rendered completely, it's impossible to scroll at correct position.
When executes custom JS,
Few steps next (almost ready)
One step next (finally dom is ready)
Only way to execute JS from CGAddJavaScriptToAjaxResponse at moment when dom is ready - use setTimeout which will sometimes work and sometimes not (on slow PC), in addition user will see how page scrolls down which is not cool at all(
i don't like setTimeout and don't know how to be.
Probably i have to carefully patch IW source once more or find other solution.
Future IW update becomes more and more hard task.
Maybe you can discuss this issue with Alexandre?