Marselo Bonagi
Marselo Bonagi

Reputation: 173

start timeCircles plugin in bootstrap modal

I am trying to start timeCircles plugin in bootstrap modal window. here is plugin: http://git.wimbarelds.nl/TimeCircles/index.html loading data in modal body from server and starting timeCircles in there $(".mytimer").TimeCircles();:

$(document).ready(function() {
    $("#mymodal").on("show.bs.modal", function(e) {
        var link = $(e.relatedTarget);
        $(this).find(".modal-body").load('/load-from-link/');
        $(".mytimer").TimeCircles();
    });

in the HTML loaded from server I place something like this and another data:

        <div class="col-sm-3">
            <div class="mytimer" data-timer="{{timer:seconds}}"></div>
        </div>

But this is not work. But if I try to start it manually from browser console printing there this: $(".mytimer").TimeCircles(); it works and timer starts. Please tell me where I made mistake.

Upvotes: 0

Views: 106

Answers (1)

Bertrand
Bertrand

Reputation: 50

Did you try to put some timeout ?

$("#mymodal").on("show.bs.modal", function(e) {
  var link = $(e.relatedTarget);
  $(this).find(".modal-body").load('/load-from-link/');
  setTimeout(function() {
    $(".mytimer").TimeCircles();
  }, 100);
});

Hope it was helpful !

Upvotes: 1

Related Questions