Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad and access all images on load
    primarykey
    data
    text
    <p>I have a page where the menu buttons(which are images) are white but i want them to turn red on hover and back to white onmouseout. So i have the corresponding red menu buttons. So if the white button is motors1.jpg, the red button is motors2.jpg hence the JQuery code below algorithm.</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;img class="navimg" src="images/home1.gif"/&gt;&lt;/td&gt; &lt;td&gt;&lt;img class="navimg" src="images/motors1.gif"/&gt;&lt;/td&gt; &lt;td&gt;&lt;img class="navimg" src="images/about_us1.gif"/&gt;&lt;/td&gt; &lt;td&gt;&lt;img class="navimg" src="images/media1.gif"/&gt;&lt;/td&gt; &lt;td&gt;&lt;img class="navimg" src="images/forums1.gif"/&gt;&lt;/td&gt; &lt;td&gt;&lt;img class="navimg" src="images/dealers1.gif"/&gt;&lt;/td&gt; &lt;td&gt;&lt;img class="navimg" src="images/whats_new1.gif"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>The Jquery code is:</p> <pre><code>$(document).ready(function(){ $('.navimg').mouseover(function(){ source=$(this).attr('src').replace('1','2'); $(this).attr('src',source); }).mouseout(function(){ source= source.replace('2','1'); $(this).attr('src',source); }); }); </code></pre> <p>I have used an external CSS stylesheet for positioning </p> <pre><code> .navimg{ width: 125.5px; height: 34px; } </code></pre> <p>So the question: I noticed that there is a lag when the page is first loaded for the white buttons to change to the red ones. I assume the lag is because the red buttons were not loaded on page load(therefore are not in the browser cache) and hence the jquery code reloads them. So any way to solve this by maybe loading them as hidden inputs, loading them to the browser cache would be appreciated or any other way to solve this.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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