TD fade effect
#1
Posted 03 January 2013 - 03:34 PM
Is it possible to give fade effect to td tag???
with the help of javascript or jquery or css...
#2
Posted 03 January 2013 - 03:42 PM
jQuery can do this easily. It would be best if you go away and have a mess around.
"One of my most productive days was throwing away 1000 lines of code."
#3
Posted 03 January 2013 - 04:03 PM
anyways my table look like this..
and i want all menu td with fade effect........
if anyone know then let me know....
till then i am searching
<table id="header_table">
<tr>
<td height="81" id="header_left_td"> </td>
<td colspan="7" id="header_right_td"> </td>
</tr>
<tr>
<td id="top_menu_first_td" onclick="document.location.href='style/demo_php/return_data_javascript.php';" style="cursor:pointer;cursor:hand">❆
Admin Login ❆</td>
<td id="top_menu_td" onclick="document.location.href='add_cat.php';" style="cursor:pointer;cursor:hand">❆
Add New Category ❆</td>
<td id="top_menu_td" onclick="document.location.href='list_cat.php';" style="cursor:pointer;cursor:hand">❆
Category List ❆</td>
<td id="top_menu_td" onclick="document.location.href='add_topic.php';" style="cursor:pointer;cursor:hand">❆
Add New Topic ❆</td>
<td id="top_menu_td" onclick="document.location.href='select_cat.php';" style="cursor:pointer;cursor:hand">❆
Topic List ❆</td>
<td id="top_menu_last_td" onclick="document.location.href='test.php';" style="cursor:pointer;cursor:hand">❆
Site Settings ❆</td>
</tr>
</table>
#4
Posted 03 January 2013 - 07:28 PM
I know I need to stop just writing code for people ... Came to this realization after I wrote it. lol
Demo: http://xaotique.no-ip.org/tmp/39/
So .. lets look at what this would be like in jQuery quick.
$(document).ready(function()
{
$("#myTable td").click(function()
{
$(this).fadeOut();
});
});If you wanted to do it the long way though, you could do something like this.
window.addEventListener("load", function()
{
function fadeOut(elm, speed)
{
speed = speed / 100;
elm.style.opacity = 1;
var timer = setInterval(function()
{
if (Number(elm.style.opacity) - speed < 0)
{
elm.parentNode.removeChild(elm);
clearInerval(timer);
}
else
{
elm.style.opacity -= speed;
}
}, 50);
}
var items = window.document.querySelectorAll("#myTable td");
for (var i in items)
{
items[i].addEventListener("click", function()
{
fadeOut(this, 5);
}, false);
}
}, false);
Edited by Xaotique, 03 January 2013 - 07:37 PM.
#5
Posted 04 January 2013 - 03:54 AM
"One of my most productive days was throwing away 1000 lines of code."
#6
Posted 04 January 2013 - 08:24 AM
I've always usedYou shouldn't need window.document.querySelectorAll(). The document object inherits this method so document.querySelectorAll() should be just fine.
window.document. Habit from GM scripts. lol I don't think it makes a difference, but I could be wrong.
#7
Posted 04 January 2013 - 08:37 AM
Edited by CPD, 04 January 2013 - 08:37 AM.
"One of my most productive days was throwing away 1000 lines of code."
#8
Posted 04 January 2013 - 09:49 AM
now i am testing and will write back when it works
#9
Posted 04 January 2013 - 02:11 PM
Thanks CPD and Xaotique
Edited by arunpatal, 04 January 2013 - 02:11 PM.
#10
Posted 04 January 2013 - 03:09 PM
If I were you, I'd use the second method I showed. Simply because, there's no real reason to include jQuery just for a single action. Everything else you have is longhand, so you may as well just add one extra function.It works with the help of jquery
Thanks CPD and Xaotique
Just my thought. Glad ya got it.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












