From aa8aad90eb2846189534d838ab0ab1a754cf62bc Mon Sep 17 00:00:00 2001 From: Joshua Guedalia Date: Tue, 25 Dec 2012 00:54:23 +0200 Subject: [PATCH] added 'esc' to cancel joyride added support for jqueryexpression (in addition to class and id) for target added support for center tip and nub (works for top and bottom) --- jquery.joyride-2.0.2.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) mode change 100644 => 100755 jquery.joyride-2.0.2.js diff --git a/jquery.joyride-2.0.2.js b/jquery.joyride-2.0.2.js old mode 100644 new mode 100755 index 8ebd06d..168dd60 --- a/jquery.joyride-2.0.2.js +++ b/jquery.joyride-2.0.2.js @@ -114,6 +114,12 @@ methods.end(); }); + $(document).keyup(function(e) { + if (e.keyCode == 27) { // esc + methods.end(); + } + }); + settings.$window.bind('resize.joyride', function (e) { if (methods.is_phone()) { methods.pos_phone(); @@ -326,11 +332,14 @@ set_target : function () { var cl = settings.$li.attr('data-class'), id = settings.$li.attr('data-id'), + jq = settings.$li.attr('data-jqueryexpression'), $sel = function () { if (id) { return $(settings.document.getElementById(id)); } else if (cl) { return $('.' + cl).first(); + } else if (jq) { + return $(jq).first(); } else { return $('body'); } @@ -420,6 +429,16 @@ methods.nub_position($nub, settings.tipSettings.nubPosition, 'right'); } + + if (methods.centerTip()) { + settings.$next_tip.css({ + left: settings.$target.offset().left+(settings.$target.outerWidth()/2)-(settings.$next_tip.outerWidth()/2) + }); + $nub.css({ + left: (settings.$next_tip.outerWidth()/2)-($nub.outerWidth()/2) + }); + } + if (!methods.visible(methods.corners(settings.$next_tip)) && settings.attempts < settings.tipSettings.tipLocationPattern.length) { @@ -519,6 +538,10 @@ return true; }, + centerTip : function () { + return /center/i.test(settings.tipSettings.tipLocation); + }, + bottom : function () { return /bottom/i.test(settings.tipSettings.tipLocation); },