{"id":1756,"date":"2010-11-15T10:24:58","date_gmt":"2010-11-15T15:24:58","guid":{"rendered":"http:\/\/mts-help.nick.php.dev\/after_sale_support\/jquery\/scrolls\/article2.html"},"modified":"2020-01-28T05:04:09","modified_gmt":"2020-01-28T10:04:09","slug":"scrollto-effect","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/scrollto-effect.html","title":{"rendered":"ScrollTo Effect"},"content":{"rendered":"<p>This script is a small, customizable plug-in that allows scrolling elements of the web page or web page window itself.<\/p> <p> <strong>JavaScript <br \/><\/strong> In order to make the script work, the <strong>index-#.html<\/strong> file with a scroller should contain these lines of HTML code in order to include <strong>jquery.ScrollTo.js<\/strong> script and jQuery framework:<\/p> <p>The <strong>&lt;head&gt;<\/strong> section of the <strong>index-#.html<\/strong> file contains these lines of code that initialize the script functionality with basic values:<\/p> <p>Main <strong>ready()<\/strong> function is quite simple to understand and works for the whole page. We just set that on clicking an element (<strong>&lt;li&gt;<\/strong> tag) with <strong>.nav &gt; li a.q1<\/strong> class the page will animate to an element with <strong>#home<\/strong> id. <strong>scrollTo()<\/strong> function has two settings: target position and attributes. Here script attributes define the following values:<\/p> <p>\u2022&nbsp; <strong>axis:<\/strong> &ndash; axis to be scrolled (could be <strong>x, y, xy, yx<\/strong>); <br \/>\u2022&nbsp; <strong>duration:<\/strong> &ndash; length of the animation, none (sync) by default; <br \/>\u2022&nbsp; <strong>queue:<\/strong> &ndash; if <strong>true<\/strong> and both axes are scrolled, it will animate on one axis, and then on the other (note that <strong>axis<\/strong> being <strong>xy<\/strong> or <strong>yx<\/strong>, concludes the order).<\/p> <p>There are many different ways to specify the target position. <br \/>These are:<\/p> <p>\u2022&nbsp;a raw number; <br \/>\u2022&nbsp;a string(&#8216; <strong>44&#8242;<\/strong>, &#8216; <strong>100px<\/strong>&#8216;, &#8216; <strong>+=30px<\/strong>&#8216;, etc ); <br \/>\u2022&nbsp;a DOM element (logically, child of the scrollable element); <br \/>\u2022&nbsp;a selector, that will be relative to the scrollable element; <br \/>\u2022&nbsp;the string &#8216; <strong>max<\/strong>&#8216; to scroll to the end; <br \/>\u2022&nbsp;a string specifying a percentage to scroll to that part of the container (f.e: 50% goes to to the middle).<\/p> <p> <strong>HTML<\/strong> <br \/>Below you can see the general HTML script representation (page blocks):<\/p> <p>Next you can see a bulleted list (<strong>&lt;ul&gt;<\/strong> tag) with the with the links to correspondent blocks. <strong>class<\/strong> attribute&nbsp;the links (<strong>&lt;a&gt;<\/strong> tags) sets which element to scroll to:<\/p>","protected":false},"excerpt":{"rendered":"<p>This script is a small, customizable plug-in that allows scrolling elements of the web page or web page window itself. JavaScript In order to make the script work, the index-#.html file with a scroller should contain these lines of HTML code in order to include jquery.ScrollTo.js script and jQuery framework: The &lt;head&gt; section of the [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[263],"tags":[813],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1756"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=1756"}],"version-history":[{"count":5,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1756\/revisions"}],"predecessor-version":[{"id":85738,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1756\/revisions\/85738"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=1756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=1756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=1756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}