Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to make modal background clickable or not #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions joyride-2.1.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ body {
display: none;
top: 0;
left: 0;
}

.joyride-clickable{
cursor: pointer;
}

Expand Down
13 changes: 11 additions & 2 deletions jquery.joyride-2.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'localStorageKey' : 'joyride', // Keyname in localstorage
'tipContainer' : 'body', // Where will the tip be attached
'modal' : false, // Whether to cover page with modal during the tour
'modalClick' : true, // Whether the cover page is clickable
'expose' : false, // Whether to expose the elements at each step in the tour (requires modal:true)
'postExposeCallback' : $.noop, // A method to call after an element has been exposed
'preRideCallback' : $.noop, // A method to call before the tour starts (passed index, tip, and cloned exposed element)
Expand Down Expand Up @@ -61,6 +62,7 @@
return this.each(function () {

if ($.isEmptyObject(settings)) {
var nextTipClickableClassSelector = '.joyride-next-tip';
settings = $.extend(true, defaults, opts);

// non configurable settings
Expand Down Expand Up @@ -110,7 +112,10 @@

}

settings.$document.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
if(settings.modalClick){
nextTipClickableClassSelector += ', .joyride-modal-bg';
}
settings.$document.on('click.joyride', nextTipClickableClassSelector, function (e) {
e.preventDefault();

if (settings.$li.next().length < 1) {
Expand Down Expand Up @@ -600,7 +605,11 @@

show_modal : function() {
if ($('.joyride-modal-bg').length < 1) {
$('body').append(settings.template.modal).show();
var $modal = $('body').append(settings.template.modal);
$modal.show();
if(settings.modalClick){
$modal.addClass('joyride-clickable');
}
}

if (/pop/i.test(settings.tipAnimation)) {
Expand Down