scroll to top on alert
Hi!
When I open a bootbox.alert window and the document is higher than the browser viewport, the document scrolls always to the top of the page. Is there a way to avoid this behaviour?
The same problem is also described here: http://stackoverflow.com/questions/12575222/bootbox-js-is-scrolling-the-window-up
regards franz
Hi,
If you scroll down to the examples section on http://bootboxjs.com/ do these suffer the same issue? If the examples are fine then it must be code related; anything in your browser's console?
If you could let me know OS / browser etc if the problem persists that would be great :)
EDIT: my memory's failing me; preventing the event on the button / link / whatever which triggers the dialog is up to the developer; are you sure you're doing this correctly?
The examples are working fine. But it does now work in my environment :-( So, it seems there is a problem in my code.
Thank you!
Happy to try and help if you can paste me any console errors :). Are you calling e.preventDefault() inside the handler which then invokes bootbox?
That was the problem! :-)
Thank you!
I solve this problem. this is the solution: change the code of bootstrap.js,change the function:Modal.prototype.show: var scrollTop=$(window).scrollTop(); that.$element.addClass('in').attr('aria-hidden', false).focus() $(window).scrollTop(scrollTop);
$('.modal').animate({scrollTop:0}, 500, 'swing');