Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>jspane does not work with old style anchors e.g. </p> <pre><code>&lt;a name="anchor"&gt;&lt;/a&gt; </code></pre> <p>instead you have to write</p> <pre><code>&lt;a id="anchor"&gt;&lt;/a&gt; </code></pre> <p>additionaly you have to enable</p> <pre><code>hijackInternalLinks: true; </code></pre> <p>in jScrollPane settings Object.</p> <p>The hijackInternalLinks also captures links from outside the scrollpane, if you only need internal links you can add this code, like hijackInternalLinks it binds the click funktion on the a elements and calls the scrollToElement with the target:</p> <pre><code> \$(document).ready(function() { panes = \$(".scroll"); //hijackInternalLinks: true; panes.jScrollPane({ }); panes.each(function(i,obj){ var pane = \$(obj); var api = pane.data('jsp'); var links = pane.find("a"); links.bind('click', function() { var uriParts = this.href.split('#'); if (uriParts.length == 2) { var target = '#' + uriParts[1]; try{ api.scrollToElement(target, true); }catch(e){ alert(e); } return false; } }); }); }); </code></pre> <p>but note you will always have to use the id attribute on a tags. If you are using tinymce you can repair the code with this function</p> <pre><code>function myCustomCleanup(type, value) { switch (type) { case "get_from_editor_dom": var as = value.getElementsByTagName("a"); for(var i=0; i&lt; as.length;i++){ if (as[i].hasAttribute('name')){ var name = as[i].getAttribute('name'); as[i].setAttribute('id',name); } } break; } return value; </code></pre> <p>}</p>
 

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