';
169 | return html;
170 | }
171 | });
172 | ```
173 |
174 | Async simply by url
175 | ```javascript
176 | $('a').webuiPopover({
177 | type:'async',
178 | url:'http://some.website/htmldata'
179 | });
180 | ```
181 |
182 | Trigger the Popover by manual
183 | ```javascript
184 | //Initailize
185 | $('a').webuiPopover({trigger:'manual'});
186 | ...
187 |
188 | //Show it
189 | $('a').webuiPopover('show');
190 |
191 | //Hide it
192 | $('a').webuiPopover('hide');
193 |
194 | ```
195 |
196 | Destroy the Popover
197 | ```javascript
198 | $('a').webuiPopover('destroy');
199 | ```
200 |
201 |
202 |
203 | ### Default options
204 | ```javascript
205 | {
206 | placement:'auto',//values: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left,auto-top,auto-right,auto-bottom,auto-left,horizontal,vertical
207 | container: document.body,// The container in which the popover will be added (i.e. The parent scrolling area). May be a jquery object, a selector string or a HTML element. See https://jsfiddle.net/1x21rj9e/1/
208 | width:'auto',//can be set with number
209 | height:'auto',//can be set with number
210 | trigger:'click',//values: click,hover,manual(handle events by your self),sticky(always show after popover is created);
211 | selector:false,// jQuery selector, if a selector is provided, popover objects will be delegated to the specified.
212 | style:'',// Not to be confused with inline `style=""`, adds a classname to the container for styling, prefixed by `webui-popover-`. Default '' (light theme), 'inverse' for dark theme
213 | animation:null, //pop with animation,values: pop,fade (only take effect in the browser which support css3 transition)
214 | delay: {//show and hide delay time of the popover, works only when trigger is 'hover',the value can be number or object
215 | show: null,
216 | hide: 300
217 | },
218 | async: {
219 | type:'GET', // ajax request method type, default is GET
220 | before: function(that, xhr, settings) {},//executed before ajax request
221 | success: function(that, data) {}//executed after successful ajax request
222 | error: function(that, xhr, data) {} //executed after error ajax request
223 | },
224 | cache:true,//if cache is set to false,popover will destroy and recreate
225 | multi:false,//allow other popovers in page at same time
226 | arrow:true,//show arrow or not
227 | title:'',//the popover title, if title is set to empty string,title bar will auto hide
228 | content:'',//content of the popover,content can be function
229 | closeable:false,//display close button or not
230 | direction:'', // direction of the popover content default is ltr ,values:'rtl';
231 | padding:true,//content padding
232 | type:'html',//content type, values:'html','iframe','async'
233 | url:'',//if type equals 'html', value should be jQuery selecor. if type equels 'async' the plugin will load content by url.
234 | backdrop:false,//if backdrop is set to true, popover will use backdrop on open
235 | dismissible:true, // if popover can be dismissed by outside click or escape key
236 | autoHide:false, // automatic hide the popover by a specified timeout, the value must be false,or a number(1000 = 1s).
237 | offsetTop:0, // offset the top of the popover
238 | offsetLeft:0, // offset the left of the popover
239 | onShow: function($element) {}, // callback after show
240 | onHide: function($element) {}, // callback after hide
241 | }
242 | ```
243 |
244 | ###Global Methods
245 |
246 |
247 | In some situation, you may want to manipulate the plugin like 'show/hide' popovers by global methods. The new object **WebuiPopovers** is introduced and exposed to the global window object, so you can access these methods like 'WebuiPopovers.someMethod()...'.
248 |
249 | Here are examples of calling code.
250 |
251 | ```javascript
252 |
253 | //Show Popover by click other element.
254 | $('a').on('click',function(e){
255 | e.stopPropagation(); // Stop event propagation is needed, otherwise may trigger the document body click event handled by plugin.
256 | WebuiPopovers.show('#el');
257 | });
258 |
259 | // Show Popover with options
260 | WebuiPopovers.show('#el',{title:' hello popover',width:300});
261 |
262 |
263 | //Hide Popover by jQuery selector
264 | WebuiPopovers.hide('#el');
265 |
266 | //Hide All Popovers
267 | WebuiPopovers.hideAll();
268 |
269 | //Update the Popover content
270 | WebuiPopovers.updateContent('.btn-showpop','some html or text');
271 |
272 |
273 | //Update the Popover content async
274 | WebuiPopovers.updateContentAsync('.btn-showpop','http://someUrl');
275 |
276 | //Set global default options
277 | WebuiPopovers.setDefaultOptions(options);
278 | ```
279 |
280 | Full Methods
281 |
282 | ```js
283 | WebuiPopovers.show(selector,options); // Show popover by jQuery selector,the options parameter is optional
284 | WebuiPopovers.hide(selector); // Hide popover by jQuery selector
285 | WebuiPopovers.hideAll(); // Hide all popovers
286 | WebuiPopovers.create(selector,options);// Create and init the popover by jQuery selector.
287 | WebuiPopovers.isCreated(selector); // Check if the popover is already create and bind to the selector.
288 | WebuiPopovers.updateContent(selector,newContent) //Update the Popover content after the popover is created.
289 | WebuiPopovers.updateContentAsync(selector,url) //Update the Popover content asynchronously after the popover is created.
290 | WebuiPopovers.setDefaultOptions(options) //Change the global default options.
291 | ```
292 |
293 |
294 |
295 | Welcome to visit my github page: [http://sandywalker.github.io/]
296 |
--------------------------------------------------------------------------------
/ROADMAP.md:
--------------------------------------------------------------------------------
1 |
2 | 2015-12
3 |
4 | * Optimize the display on mobile device
5 | * Add fit width/height to some container
6 | * Nested popover support
7 | * unique option for performer optimize when huge number of the popovers in same page.
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "webui-popover",
3 | "version": "1.2.18",
4 | "authors": [
5 | "sandywalker "
6 | ],
7 | "description": "webui popover",
8 | "keywords": [
9 | "jquery",
10 | "plugins"
11 | ],
12 | "license": "MIT",
13 | "private": false,
14 | "ignore": [
15 | "**/.*",
16 | "node_modules",
17 | "bower_components",
18 | "test",
19 | "tests"
20 | ],
21 | "main": [
22 | "dist/jquery.webui-popover.css",
23 | "dist/jquery.webui-popover.js"
24 | ],
25 | "dependencies": {
26 | "jquery": ">=1.7.0"
27 | },
28 | "homepage":"https://github.com/sandywalker/webui-popover"
29 | }
30 |
--------------------------------------------------------------------------------
/demo/async-content-another.html:
--------------------------------------------------------------------------------
1 |
Another Async Content
2 |
3 | A lightWeight popover plugin with jquery ,enchance the popover plugin of bootstrap with some awesome new features.
4 |
3 | 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!
4 |
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!
click The jQuery Foundation’s mission has always been about more than just our namesake projects of jQuery, jQuery UI, and jQuery Mobile. We already host several projects such as Sizzle, QUnit and Globalize that are not dependent on the jQuery library.
432 |
This wider web-oriented mission is evident in our jQuery Conferences, which span a wide range of developer concerns beyond jQuery, including Node, CSS, tooling, testing and much more. Over the years we’ve had talks on build tools, accessibility, security, performance, design patterns, and frameworks such as Ember and Angular. At our San Diego conference this past February, for example, Lenny Markus gave a great talk on PayPal’s continuing adoption of Node as they move away from Java and proprietary solutions, Catherine Farman talked about real world responsive design, and John Dimm gave a talk on the HTML5 speech APIs.
433 |
The jQuery Foundation is participating in the continuing evolution of the web platform via our memberships in both the W3C and ECMA TC39 (The group standardizing what we know as JavaScript). We feel that it’s essential to have strong representation in those standards groups to ensure they meet the needs of developers. The Foundation provides a platform for developers to have a voice in these standards bodies.
434 |
Beyond the technical compatibility between our projects, we also share the open source model and all the benefits it provides. The Foundation adds the benefit of a top-level structure designed to serve the projects, providing the resources they need but letting the contributors decide the best direction for the project based on community input. Any project that joins the Foundation is given the ability to serve their community’s needs rather than be constrained by the goals of a for-profit company.
435 |
Though this has been our mission for a long time, we felt we needed to make this clearer. We are excited to start bringing this part of our mission into the light and start actively working toward a more open web accessible to everyone. If you are excited as well, please help us. Contribute your time to Foundation projects. Offer your company’s services. If you or your company have an established open source project that you believe could benefit everyone and flourish by becoming part of the jQuery Foundation, check out our philosophy around projects joining the Foundation and let us know you’re interested. If you would rather just support the existing and future projects of the Foundation through financial support, become a member of the Foundation. Open source projects will only thrive if everyone who benefits from them contributes back in whatever way they can.
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!
click The jQuery Foundation’s mission has always been about more than just our namesake projects of jQuery, jQuery UI, and jQuery Mobile. We already host several projects such as Sizzle, QUnit and Globalize that are not dependent on the jQuery library.
498 |
This wider web-oriented mission is evident in our jQuery Conferences, which span a wide range of developer concerns beyond jQuery, including Node, CSS, tooling, testing and much more. Over the years we’ve had talks on build tools, accessibility, security, performance, design patterns, and frameworks such as Ember and Angular. At our San Diego conference this past February, for example, Lenny Markus gave a great talk on PayPal’s continuing adoption of Node as they move away from Java and proprietary solutions, Catherine Farman talked about real world responsive design, and John Dimm gave a talk on the HTML5 speech APIs.
499 |
The jQuery Foundation is participating in the continuing evolution of the web platform via our memberships in both the W3C and ECMA TC39 (The group standardizing what we know as JavaScript). We feel that it’s essential to have strong representation in those standards groups to ensure they meet the needs of developers. The Foundation provides a platform for developers to have a voice in these standards bodies.
500 |
Beyond the technical compatibility between our projects, we also share the open source model and all the benefits it provides. The Foundation adds the benefit of a top-level structure designed to serve the projects, providing the resources they need but letting the contributors decide the best direction for the project based on community input. Any project that joins the Foundation is given the ability to serve their community’s needs rather than be constrained by the goals of a for-profit company.
501 |
Though this has been our mission for a long time, we felt we needed to make this clearer. We are excited to start bringing this part of our mission into the light and start actively working toward a more open web accessible to everyone. If you are excited as well, please help us. Contribute your time to Foundation projects. Offer your company’s services. If you or your company have an established open source project that you believe could benefit everyone and flourish by becoming part of the jQuery Foundation, check out our philosophy around projects joining the Foundation and let us know you’re interested. If you would rather just support the existing and future projects of the Foundation through financial support, become a member of the Foundation. Open source projects will only thrive if everyone who benefits from them contributes back in whatever way they can.