Skip to content

A lightWeight popover plugin with jquery ,enchance the popover plugin of bootstrap with some awesome new features

License

Notifications You must be signed in to change notification settings

bazingarj/webui-popover

 
 

Repository files navigation

WebUI-Popover

A lightWeight popover plugin with jquery ,enchance the popover plugin of bootstrap with some awesome new features. It works well with bootstrap ,but bootstrap is not necessary!

Browser compatibility: ie8+,Chrome,Safari,Firefox,Opera

Requirement

jquery1.7+

##Features

  • fast,lightweight
  • support more placements
  • auto caculate placement
  • close button in popover
  • multipule popovers in same page
  • different styles
  • support url and iframe
  • support async mode

##Demo WebUI Popover Demo

##Getting Started

####Including it on your page

<link rel="stylesheet" href="jquery.webui-popover.css">
...
<script src="jquery.js"></script>
<script src="jquery.webui-popover.js"></script>

####Use the plugin as follows:

$('a').webuiPopover(options);

####Some Examples:

Create Simplest Popover

$('a').webuiPopover({title:'Title',content:'Content'});

Create Popover by dom element data-* attribute

<a href="#" data-title="Title" data-content="Contents..." data-placement="right"></a>
$('a').webuiPopover();

Create Popover with bottom placement

$('a').webuiPopover({title:'Title',content:'Content',placement:'bottom'});

Create Popover trigged by mouse hover

$('a').webuiPopover({title:'Title',content:'Content',trigger:'hover'});

Create inversed style Popover

$('a').webuiPopover({title:'Title',content:'Content',style:'inverse'});

Create Popover with fixed width and height

$('a').webuiPopover({title:'Title',content:'Content',width:300,height:200});

Create Popover with close button

$('a').webuiPopover({title:'Title',content:'Content',closeable:true});

Create and Animate the Popover

$('a').webuiPopover({title:'Title',content:'Content',animation:'pop'});

Create Popover with iframe

$('a').webuiPopover({type:'iframe',url:'http://getbootstrap.com'});

Create Popover Async Mode

$('a').webuiPopover({	
						type:'async',
						url:'https://api.github.com/',
						content:function(data){
 							var html = '<ul>';
 							for(var key in data){html+='<li>'+data[key]+'</li>';}
							html+='</ul>';
							return html;
						}	
 					});

Create Popover and trigged by manual

 //Initailize 
 $('a').webuiPopover({trigger:'manual'});

...
 
 //Show it
 $('a').webuiPopover('show');

default options

{
	placement:'auto',//values: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left,auto-top,auto-right,auto-bottom,auto-left
	width:'auto',//can be set with  number
	height:'auto',//can be set with  number
	trigger:'click',//values:  click,hover,manual
	style:'',//values:'',inverse
	constrains:null, // constrains the direction when placement is  auto,  values: horizontal,vertical
	animation:null, //pop with animation,values: pop,fade (only take effect in the browser which support css3 transition)
	delay: {//show and hide delay time of the popover, works only when trigger is 'hover',the value can be number or object
	    show: null,
	    hide: 300
	},
	async: {
	    before: function(that, xhr) {},//executed before ajax request
	    success: function(that, data) {}//executed after successful ajax request
	},
	cache:true,//if cache is set to false,popover will destroy and recreate
	multi:false,//allow other popovers in page at same time
	arrow:true,//show arrow or not
	title:'',//the popover title ,if title is set to empty string,title bar will auto hide
	content:'',//content of the popover,content can be function
	closeable:false,//display close button or not
	padding:true,//content padding
	type:'html',//content type, values:'html','iframe','async'
	url:'',//if not empty ,plugin will load content by url
	backdrop:false,//if backdrop is set to true, popover will use backdrop on open
	dismissible:true // if popover can be dismissed by  outside click or escape key
}

Welcome to visit my github page: [http://sandywalker.github.io/]

About

A lightWeight popover plugin with jquery ,enchance the popover plugin of bootstrap with some awesome new features

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 46.6%
  • JavaScript 40.4%
  • CSS 13.0%