简体   繁体   中英

Twitter Bootstrap tooltips break on page change because of $(document).ready

Since jQuery $(document).ready only fires once. My Twitter bootstrap tooltips break on changing of pages.

I currently use something simple like below to initialize my tooltips:

$(function () {
// for tooltips
  $('body').tooltip({
    selector: '[rel=tooltip]'
  });
});

Is there a better way to go about this?

Found the answer!

var ready;
ready = function() {

  ...your javascript goes here...

};

$(document).ready(ready);
$(document).on('page:load', ready);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM