Skip to content

Commit a790c5d

Browse files
committed
add dismissible option
1 parent e9aed14 commit a790c5d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ Create Popover and trigged by manual
142142
closeable:false,//display close button or not
143143
padding:true,//content padding
144144
type:'html',//content type, values:'html','iframe','async'
145-
url:''//if not empty ,plugin will load content by url,
145+
url:'',//if not empty ,plugin will load content by url
146146
backdrop:false,//if backdrop is set to true, popover will use backdrop on open
147+
dismissible:true // if popover can be dismissed by outside click or escape key
147148
}
148149
```
149150

src/jquery.webui-popover.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@
4040
'<div class="webui-popover-content"><i class="icon-refresh"></i> <p>&nbsp;</p></div>' +
4141
'</div>' +
4242
'</div>',
43-
onShow: false,
44-
onHide: false
43+
backdrop:false,
44+
dismissible:true,
45+
onShow: null,
46+
onHide: null
4547
};
4648

4749

@@ -417,8 +419,10 @@
417419
},
418420

419421
bindBodyEvents: function() {
420-
$('body').off('keyup.webui-popover').on('keyup.webui-popover', $.proxy(this.escapeHandler, this));
421-
$('body').off('click.webui-popover').on('click.webui-popover', $.proxy(this.bodyClickHandler, this));
422+
if (this.options.dismissible){
423+
$('body').off('keyup.webui-popover').on('keyup.webui-popover', $.proxy(this.escapeHandler, this));
424+
$('body').off('click.webui-popover').on('click.webui-popover', $.proxy(this.bodyClickHandler, this));
425+
}
422426
},
423427

424428
/* event handlers */

0 commit comments

Comments
 (0)