jquery Hover and while loop
Posted
by
DragoN
on Stack Overflow
See other posts from Stack Overflow
or by DragoN
Published on 2012-09-07T03:36:53Z
Indexed on
2012/09/07
3:37 UTC
Read the original article
Hit count: 132
jQuery
i have a table of php with while loop to show the records i added a jquery hover to do that : if hovered it show a message in same row but the problem is : if hover it show a message in all rows
here is css:
<style>
.tansa{
position: absolute;
margin-right: -60px;
margin-top:-25px;
background: #CBDFF3; border: 1px solid #4081C3; font-size: 0.88em;
padding: 2px 7px; display: inline-block;
border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px;
line-height: 1.2em;
text-shadow: 0 0 0em #FFF;
overflow: hidden;
text-align: center;
color:black;
display:none;
}
.arrow{
position: relative;
width: 0;
height: 0;
top: -25px;
border-top: 5px solid #000000;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
display:none;
}
</style>
here is my php :
<table><tr>row</tr>
<?php
$results = mysql_query("select * from MyTable");
while{$r = mysql_fetch_array($results)){
echo "<tr><td>Row : <img src='img/tans.png' width='24' height='24' class='tansef' /><span class='tansa' >the message</span><div class='arrow'></div></td></tr>";
}
?>
</table>
here is jquery
$(document).ready(function(){
$('.tansef').hover(function(){
var sh = $('.tansa');
var sharrow = $('.arrow');
sh.show();
sharrow.show();
},function(){
var shs = $('.tansa');
var sharrows = $('.arrow');
shs.hide();
sharrows.hide();
});
});
any solution to show the message in each row only
© Stack Overflow or respective owner