Created
July 27, 2012 02:02
-
-
Save simon-lang/3185777 to your computer and use it in GitHub Desktop.
tooltips.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*! | |
| * ProjectName Tooltips | |
| * @requires jQuery v1.7.2+ | |
| * @requires bootstrap-tooltip.js | |
| * | |
| * Simple wrapper for the Bootstrap Tooltip module | |
| * | |
| * @author Digicon http://www.digicon.com.au/ | |
| */ | |
| ;(function($) { | |
| window.ProjectName.Tooltip = window.ProjectName.Tooltip || window.ProjectName.Module(function() { | |
| var _selector = '.has-tooltip'; | |
| var _options = { | |
| animation: true, | |
| placement: 'bottom' | |
| }; | |
| return { | |
| init: function() { | |
| this.ify($(_selector)); | |
| }, | |
| ify: function($el, additionalOptions) { | |
| if (additionalOptions) { | |
| _options = $.extend(_options, additionalOptions); | |
| } | |
| $el.find(_selector).tooltip(_options); | |
| } | |
| } | |
| }()); | |
| })(jQuery); | |
| // Reason for the .ify method... (Ajax!) | |
| ProjectName.SearchForm = { | |
| doSearch: function() { | |
| $('.results').load(function() { | |
| // $(this) == $('.results') (more or less) | |
| ProjectName.Tooltip.ify($(this), { | |
| placement: 'left' | |
| }); | |
| }); | |
| } | |
| } | |
| ProjectName.SearchForm.doSearch(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Untested!