<div class="task">
<div> Task One <span> Moderator </span> </div>
<div> Task Two <span> Moderator </span> </div>
<div> Task Three <span> Moderator </span> </div>
</div>
<div class="task">
<div> Task One <span> Moderator </span> </div>
<div> Task Two <span> Moderator </span> </div>
<div> Task Three <span> Moderator </span> </div>
</div>
And all together:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Test</title>
<style type="text/css">
.task div span {
display: none;
}
.task div.hover span {
display: inline;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(function() {
$('.task div').hover(function() {
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
});
</script>
</head>
<body>
<div class="task">
<div> Task One <span> Moderator </span> </div>
<div> Task Two <span> Moderator </span> </div>
<div> Task Three <span> Moderator </span> </div>
</div>
</body>
</html>
I am using this slickbox code, but want to use it for multiple divs with different variables.
<script>
$(document).ready(function() {
$('#slickbox').hide();
$('a#slick-toggle').click(function() {
var newHref = $(this).attr("href");
$('#slickbox_' + newHref).toggle(400);
return false;
});
});
<a href="1" id="slick-toggle">Toggle the box</a></p>
<div id="slickbox_1">This is the box that will be shown and hidden and toggled at your whim. :)</div>
<a href="2" id="slick-toggle">Toggle the box</a></p>
<div id="slickbox_2">This is the box that will be shown and hidden and toggled at your whim. :)</div>
This works fine in FF but not in IE. I am desperate for some help and would really appreciate any feedback you could give me.
If i understand you correctly, then maybe you can do it this way with jQuery
$(".tasklist").hover(function(){
//auto gets the containing div id (in this case: do_1, do_2, do_3)
var divId = $(this).attr('id');
//then auto gets the span id of its containing div (in this case: mod_1, mod_2, mod_3)
var modId = $('#'+divId).children('span').attr('id');
//then we simply SHOW it base on whichever one the user mouseover
$('#'+modId).show();
},function(){
//Whenever the user mouseout then we need to hide the spans again
//so we practically do the same thing and just hide the span
//auto gets the containing div id (in this case: do_1, do_2, do_3)
var divId = $(this).attr('id');
//then auto gets the span id of its containing div (in this case: mod_1, mod_2, mod_3)
var modId = $('#'+divId).children('span').attr('id');
//then we simply HIDE it base on whichever one the user mouseover
$('#'+modId).hide();
});