I use bootbox.js to make modal but when the modal fadeIn and the content is too long, the scrollbar goes at the level of the bottom button. I need the scrollbar stay on top when modal appear
Asked
Active
Viewed 3,393 times
5
-
Show your code for showing bootbox. – Manwal Dec 24 '14 at 11:26
-
`var bootboxAffiche = function(p_titre, p_contenu){ bootbox.dialog({ title : p_titre, message : p_contenu, buttons:{ success: { label : 'Fermer', className: "btn-primary" } } }); }` – Thomas Mairé Dec 24 '14 at 13:08
2 Answers
5
I've solved adding .off("shown.bs.modal");
after the bootbox.dialog.
bootbox.dialog({ ... }).off("shown.bs.modal");

Emile Bergeron
- 17,074
- 5
- 83
- 129

Thomas Mairé
- 516
- 4
- 16
-
-
This is discussed in [issue #260](https://github.com/makeusabrew/bootbox/issues/260) and is caused by auto-focusing the primary button in the `shown` event. – Emile Bergeron Feb 14 '17 at 20:18
0
You can set the scrollTop with jQuery in you callback.
bootbox.alert("Hello world!", function() {
$('body').scrollTop(0);
});

giannisf
- 2,479
- 1
- 17
- 29