Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var placement = (steps[i].options && steps[i].options.placement) ? steps[i].options.placement : options.placement;
var css = {};
if (placement === 'right') {
css.top = top + (height / 3) + "px";
css.left = left + element.outerWidth() + margin;
} else if (placement === 'left') {
css.top = top + (height / 3) + "px";
css.left = (left - element.outerWidth()) - margin;
} else if (placement === 'bottom') {
css.top = (height + top + margin + 10) + "px";
if ((left + bubble.outerWidth()) > $(document).width()) {
$(".guideBubble-arrow", bubble).css({"right": "10px"});
css.left = left + (element.outerWidth() - bubble.outerWidth()) + margin;
} else {
$(".guideBubble-arrow", bubble).css({"right": "auto"});
css.left = left;
}
} else if (placement === 'top') {
css.top = (((top - bubble.outerHeight()) - margin) - 20) + "px";
if ((left + bubble.outerWidth()) > $(document).width()) {
$(".guideBubble-arrow", bubble).css({"right": "10px"});
css.left = left + element.outerWidth() - bubble.outerWidth() + margin;
} else {
$(".guideBubble-arrow", bubble).css({"right": "auto"});
css.left = left + margin;
}
}
$('.guideBubble-arrow').attr('data-placement', placement);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment