Philipp
Philipp

Reputation: 65

tinyscrollbar within a (bootstrap ) Modal

I'm going crazy because I don't get the tinyscrollbar script working since 3 hours! I try to load it in a modal box but I can't figure out the of tinyscrollbar to update as soon as I open the modal box. I already tried many - not for me working - solution from around the web.

So the code inside the modal box looks like this:

<div class="et-place-main-text">
                        <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
                        <div class="viewport">
                            <div class="overview">
                            <?php the_field('content_modal_box');?>                 
                            </div>
                        </div>
                    </div> <!-- .et-place-main-text -->

Now I need the correct code to kick tinyscrollbar_update(); as soon as someone opens the modal with this link #myModal-<? the_ID(); ?>...

It would be great if someone has an idea.

Upvotes: 0

Views: 315

Answers (1)

Laguna Web Design
Laguna Web Design

Reputation: 332

Trigger Your scrollbar on 'shown.bs.modal':

$('.modal').on('shown.bs.modal', function() {               
    scrollbar_init(); // trigger scrollbar after modal shown
});

Upvotes: 0

Related Questions