Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's your problem: </p> <p>In this line:</p> <pre><code>&lt;a href="#home" id="home"&gt;&lt;img src="main home page/purhome.jpg"&gt;&lt;/a&gt; </code></pre> <p>You are setting up a link which indeed scrolls to a certain area on the page, in this case to itself.</p> <p><code>href="#home"</code> means: when clicked on this link make the element with the <code>id</code> of <code>home</code> visible.</p> <p>The actual link which is clicked, has the <code>id</code> of <code>home</code>.</p> <p>So it ensures that whatever is inside itself is visible, browsers usually scroll down the page to the specific element with the specified <code>id</code>. This explains the behaviour.</p> <p>In your case you can just get rid of the <code>href</code> attribute on the links, that should fix it.</p> <p><strong>Edit</strong></p> <p>The easiest way for you to get the desired behaviour is to just change your <code>id</code>'s to something like this:</p> <p><strong>HTML</strong></p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#home" id="home-link"&gt;&lt;img src="main home page/purhome.jpg"&gt;&lt;/a&gt;&lt;/li&gt; ... &lt;/ul&gt; </code></pre> <p><strong>JavaScript</strong></p> <pre><code>$("#home-link").click(function() { $("#main_info2").hide(); $("#main_info").show(); }); ... </code></pre> <p>And you could even change the <code>id</code> of <code>main_info</code> to <code>home</code> to ensure <code>main_info</code> (or <code>home</code> then) is visible after clicking the link, if that is the kind of behaviour you are after.</p> <p><strong>Edit 2 - reading the hash solution</strong></p> <p><strong>HTML</strong></p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#home"&gt;&lt;img src="main home page/purhome.jpg"&gt;&lt;/a&gt;&lt;/li&gt; ... &lt;/ul&gt; &lt;div id="home"&gt;This is the tab content for the "home" tab.&lt;/div&gt; </code></pre> <p>No <code>id</code> needed on the link, but set one on the <code>&lt;div&gt;</code> or on whatever element you use to create your tab content. Now the <code>href</code> attribute on the link will ensure the right thing happens in combination with the JavaScript below which catches the click and shows the right tab based on the hash value .</p> <p><strong>JavaScript</strong></p> <pre><code>$("a").click(function() { // Hide all tab content elements. $('some-selector-which-selects-all-tab-content-elements').hide(); // Show only the tab content element with an id equal to the hash value. $(window.location.hash).show(); }); </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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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