Note that there are some explanatory texts on larger screens.

plurals
  1. POSelect an anchor within a JQUERY Tab from a link on anther webpage
    primarykey
    data
    text
    <p>i'm a complete novice at JQuery and Javascript, and was hoping you could help me out with my problem.</p> <p>I'm using JQuery 1.7.2 and JQuery-ui 1.10.3 Tabs.</p> <p>From an external url, i want to be able to link to an anchor located within a JQuery tab, however the tab name itself is also an anchor.</p> <p>I know how to activate the tab the anchor is located in </p> <pre><code>e.g. http://mysite.com/#tab-1 </code></pre> <p>but where do i go from there? </p> <p>How do I specify the anchor I want to link to located in tab-1 from a url? </p> <pre><code>e.g. http://mysite.com/#tab-1#myanchor </code></pre> <p>Here's the HTML</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;link href="/css/jquery-ui-1.10.3.custom.css" rel="stylesheet" type="text/css" media="all"/&gt; &lt;script src="http://code.jquery.com/jquery-1.7.2.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt; &lt;script&gt; $(function() {var tabs = $( "#tabs" ).tabs(); tabs.find( ".ui-tabs-nav" ).sortable( {axis: "x", stop: function() {tabs.tabs( "refresh" ); } } ); } ); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="tabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#tab-1"&gt;1st Tab&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#tab-2"&gt;2nd Tab&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#tab-3"&gt;3rd Tab&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="tab-1"&gt; &lt;h2&gt;1st Tab&lt;/h2&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas at dui tempor, adipiscing nisl id, tempus nisi. Donec posuere pulvinar lacus, non suscipit eros ultrices. &lt;/p&gt; &lt;/div&gt; &lt;!-- end of tab-1 div --&gt; &lt;div id="tab-2"&gt; &lt;h2&gt;2nd Tab&lt;/h2&gt; &lt;p&gt;Suspendisse lacus mi, ornare quis nulla eget, commodo auctor arcu. Proin ut erat vestibulum, vestibulum odio sit amet, dapibus nisi. Morbi nec semper mi. &lt;/p&gt; &lt;/div&gt; &lt;!-- End of tab-2 div --&gt; &lt;div id="tab-3"&gt; &lt;h2&gt;3rd Tab&lt;/h2&gt; &lt;p&gt;Proin ullamcorper ornare ultricies. Morbi bibendum mauris eu purus rhoncus, id lacinia sapien placerat. Nunc euismod lectus eu elit accumsan dignissim. &lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;span id="myanchor"&gt;Anchor is here&lt;/span&gt;&lt;/b&gt; &lt;/p&gt; &lt;/div&gt; &lt;!-- End of tab-3 div --&gt; &lt;/div&gt; &lt;!-- End of tabs div --&gt; &lt;/body&gt; </code></pre> <p>Any help would be gratefully appreciated. Thanks</p>
    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.
 

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