最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ScrollTop bootbox modal on fadeIn - Stack Overflow

programmeradmin1浏览0评论

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

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

Share Improve this question edited Jun 30, 2015 at 12:31 Siguza 24k6 gold badges55 silver badges99 bronze badges asked Dec 24, 2014 at 11:20 Thomas MairéThomas Mairé 5544 silver badges16 bronze badges 2
  • Show your code for showing bootbox. – Manwal Commented Dec 24, 2014 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é Commented Dec 24, 2014 at 13:08
Add a ment  | 

2 Answers 2

Reset to default 6

I've solved adding .off("shown.bs.modal"); after the bootbox.dialog.

bootbox.dialog({ ... }).off("shown.bs.modal");

You can set the scrollTop with jQuery in you callback.

 bootbox.alert("Hello world!", function() {
      $('body').scrollTop(0);
    });
发布评论

评论列表(0)

  1. 暂无评论