Created
          August 7, 2012 17:14 
        
      - 
      
- 
        Save lukmdo/3287421 to your computer and use it in GitHub Desktop. 
    persistent popover [http://addyosmani.github.com/todomvc/]
  
        
  
    
      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
    
  
  
    
  | $.fn.persistantPopover = function() { | |
| var popoverTimeout; | |
| function delay() { | |
| popoverTimeout = setTimeout(function() { | |
| $('.popover').hide(); | |
| }, 100); | |
| } | |
| return this.each(function() { | |
| var $this = $( this ); | |
| $this.popover({ | |
| trigger: 'manual', | |
| placement: 'right', | |
| animation: false, | |
| title: this.firstChild.textContent + '<a href="' + $this.data('source') + '">Website</a>' | |
| }); | |
| }) | |
| .mouseenter(function() { | |
| clearTimeout( popoverTimeout ); | |
| $('.popover').remove(); | |
| $( this ).popover('show'); | |
| }) | |
| .mouseleave(function() { | |
| delay(); | |
| $('.popover').mouseenter(function() { | |
| clearTimeout( popoverTimeout ) ; | |
| }).mouseleave(function() { | |
| delay(); | |
| }); | |
| }); | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment