Hi everyone. I'm pretty new to javascript and I can get the following example to work but repeating it over and over seems senseless. What am I missing?
<img src=/images/map/1.png class="rm1" />
<img src=/images/map/2.png class="rm2" />
<ul>
<li class='rm1'><a href="">Room 1</a></li>
<li class='rm2'><a href="">Room 2</a></li>
</ul>
<script>
jQuery(document).ready(function(jQuery){
jQuery('.rm1').hover(
function(){ jQuery('.rm1').addClass('show') },
function(){ jQuery('.rm1').removeClass('show') }
)
});
jQuery(document).ready(function(jQuery){
jQuery('.rm2').hover(
function(){ jQuery('.rm2').addClass('show') },
function(){ jQuery('.rm2').removeClass('show') }
)
});
</script>
I use it so I can have a list of links and a map. All the map elements are hidden until I hover over the link.
Unfortunately it works, but I can't stand to look at it (I know its inefficient).