-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Disable tour animation #1728
base: master
Are you sure you want to change the base?
Disable tour animation #1728
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Disable Tour Animation</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="Intro.js - Better introductions for websites and features with a step-by-step guide for your projects."> | ||
<meta name="author" content="Afshin Mehrabani (@afshinmeh) in usabli.ca group"> | ||
|
||
<!-- styles --> | ||
<link href="../assets/css/bootstrap.min.css" rel="stylesheet"> | ||
<link href="../assets/css/demo.css" rel="stylesheet"> | ||
|
||
<!-- Add IntroJs styles --> | ||
<link href="../../dist/introjs.css" rel="stylesheet"> | ||
|
||
<link href="../assets/css/bootstrap-responsive.min.css" rel="stylesheet"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div class="container-narrow"> | ||
|
||
<div class="masthead"> | ||
<ul class="nav nav-pills pull-right" data-step="5" data-intro="Get it, use it."> | ||
<li><a href="https://github.com/usablica/intro.js/tags"><i class='icon-black icon-download-alt'></i> Download</a></li> | ||
<li><a href="https://github.com/usablica/intro.js">Github</a></li> | ||
<li><a href="https://twitter.com/usablica">@usablica</a></li> | ||
</ul> | ||
<h3 class="muted">Intro.js</h3> | ||
</div> | ||
|
||
<hr> | ||
|
||
<div class="jumbotron"> | ||
<h1 data-step="1" data-intro="This is a tooltip!" data-title="A short title">Disable Tour Animation</h1> | ||
<p class="lead" data-step="4" data-intro="Another step." data-title="foo">This example disables the tour animation using the <code>tourAnimation</code> option.</p> | ||
<a class="btn btn-large btn-success" href="javascript:void(0);" onclick="javascript:introJs().setOption('tourAnimation', false).start();">Show me how</a> | ||
</div> | ||
|
||
<hr> | ||
|
||
<div class="row-fluid marketing"> | ||
<div class="span6" data-step="2" data-title="A very long title containing a lot of unnecessary text so that the title spans over multiple lines" data-intro="Ok, wasn't that fun?" data-position='right' data-scrollTo='tooltip'> | ||
<h4>Section One</h4> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis augue a neque cursus ac blandit orci faucibus. Phasellus nec metus purus.</p> | ||
|
||
<h4>Section Two</h4> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis augue a neque cursus ac blandit orci faucibus. Phasellus nec metus purus.</p> | ||
|
||
<h4>Section Three</h4> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis augue a neque cursus ac blandit orci faucibus. Phasellus nec metus purus.</p> | ||
</div> | ||
|
||
<div class="span6" data-step="3" data-intro="More features, more fun." data-position='left'> | ||
<h4>Section Four</h4> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis augue a neque cursus ac blandit orci faucibus. Phasellus nec metus purus.</p> | ||
|
||
<h4>Section Five</h4> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis augue a neque cursus ac blandit orci faucibus. Phasellus nec metus purus.</p> | ||
|
||
<h4>Section Six</h4> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis augue a neque cursus ac blandit orci faucibus. Phasellus nec metus purus.</p> | ||
|
||
</div> | ||
</div> | ||
|
||
<hr> | ||
</div> | ||
<script type="text/javascript" src="../../dist/intro.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,21 +30,25 @@ export default function scrollTo(scrollTo, { element }, tooltipLayer) { | |
// the center of the target element or tooltip. | ||
|
||
if (top < 0 || element.clientHeight > winHeight) { | ||
window.scrollBy( | ||
0, | ||
rect.top - | ||
window.scrollBy({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be great if we add some Cypress tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. What would you test in this case? It still uses the same function window.scrollBy() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the delay @sammuell. We usually have a delay() between each step in the Cypress tests to make sure the transition is complete. Now that the transition can be enabled/disabled, we can probably have a test without that delay(), take a screenshot and that should capture the tooltip in its correct position. Would that be a useful test case? |
||
top: rect.top - | ||
(winHeight / 2 - rect.height / 2) - | ||
this._options.scrollPadding | ||
); // 30px padding from edge to look nice | ||
// 30px padding from edge to look nice | ||
this._options.scrollPadding, | ||
left: 0, | ||
behavior: 'smooth' | ||
}); | ||
|
||
//Scroll down | ||
} else { | ||
window.scrollBy( | ||
0, | ||
rect.top - | ||
//Scroll down | ||
window.scrollBy({ | ||
top: rect.top - | ||
(winHeight / 2 - rect.height / 2) + | ||
this._options.scrollPadding | ||
); // 30px padding from edge to look nice | ||
// 30px padding from edge to look nice | ||
this._options.scrollPadding, | ||
left: 0, | ||
behavior: 'smooth' | ||
}); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be amazing if the timeout can also be configurable, maybe a new prop
tooltipTimeoutMs
to customize the timemout ms can be defined