javascript - Trouble with Tooltips in Bootstrap 3 / Wordpress -
i'm having trouble getting tooltips work while attempting follow this example (under "markup") official bootstrap documentation.
<a href="#" data-toggle="tooltip" title="first tooltip">hover on me</a> trigger tooltip using javascript:
$('#example').tooltip(options) my question whether or not should add javascript code (the "trigger" it's referred to) header.php or if should somehow enqueue function in function.php (which i'm not sure how properly), or if should put in tags on page rest of content. nothing i've tried far has worked properly. thanks!
the trigger needs fired once element loaded jquery , twitter bootstrap javascript has been loaded.
this depends on wordpress theme , how has been setup.
where putting in javascript?
if you've used bootstrap did manually add css , js files theme? or did use boilerplate base theme?
you want js load after other scripts have been initialized.
if haven't included own javascipt yet, suggest doing following.
create main.js file , place in folder make called 'js'.
in footer.php (if you've got 1 in theme), right before </body> add:
<script src="js/main.js></script> then in js file you'll want add 'trigger' call.
$('#example').tooltip(options) another problem may experiencing if calling trigger , element isn't on page. (did ajax element page?)
hope helps.
Comments
Post a Comment