Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is how it works. At the end of your "$(document).ready(function(){"-function add:</p> <pre><code>$("#right").click(function() { $("#makeMeScrollable").smoothDivScroll("option","autoScrollDirection","right"); }); $("#left").click(function() { $("#makeMeScrollable").smoothDivScroll("option","autoScrollDirection","left"); }); $("#backandforth").click(function() { $("#makeMeScrollable").smoothDivScroll("option","autoScrollDirection","backandforth"); }); </code></pre> <h2>Ok, What does that do?</h2> <ol> <li>You defined spans with ID's as "left", "right" and so on (e.g. <code>&lt;span id="left"&gt;left&lt;/span&gt;</code>). In jQuery you select them via a selector, which is a string describing what is to be selected. To select an element by ID the string starts with "#" followed by the ID. To execute a selector use $(selector) as $("#left") which selects the &lt;span&gt;-Tag with id="left";</li> <li>We want to assign a handler function for the click event to this selected element. So we write <code>$("#left").click( ... );</code>. And as a parameter we put in a function without parameters, which will be executed when the &lt;span&gt; is clicked on.</li> <li>Inside that event handler function we change the options of the smoothDivScroll.</li> </ol> <h2>More Info</h2> <ul> <li>The options are explained here: <a href="http://www.smoothdivscroll.com/options.html" rel="nofollow">http://www.smoothdivscroll.com/options.html</a></li> <li>And how to change options is explained here: <a href="http://www.smoothdivscroll.com/alteringOptions.html" rel="nofollow">http://www.smoothdivscroll.com/alteringOptions.html</a></li> </ul> <h2>Click vs. OnMouseOver</h2> <p>If you want to react to the mouseover event, just write <code>.mouseover(...)</code> instead of <code>.click(...)</code></p> <h3>Additionally: Bug in your CSS?</h3> <p>You should also fix your CSS, add a ";" behind 330px; and a "float: left;":</p> <pre><code>#makemescrollable { position: relative; width: 100%; height: 330px; float: left; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload