Kalle H. Väravas Kalle H. Väravas - 1 year ago 84
jQuery Question

Delay() bugged on table row reorder

I have a simple script to change pages order for a cms. It is based on reordering table rows with jQuery. Now the issue is, that I want to remove the highlight class from the full row with a delay. It ignores the delay() and removes it right away.

The idea is, that when you hover over a row, it will add cell_rollover class to it. When you click on a up/down arrow, then the class remains to that row -- showing you, that the row moved. So after about 200 milliseconds, it should remove the class. It doesn't..

The code for the arrows:

$(".listtable_up, .listtable_down").click(function() {
var row = $(this).parents("tr:first");
if ($(this).is(".listtable_up")) {
} else {

NOTE: The cell_rover class is being added to the row with a jQuery script:

$(".listtable tbody td").hover(function () {
}, function () {

Why does this happen and how to fix it?

Solution to my general idea is in the form of jquery effect highlight: http://jsfiddle.net/sZdre/1/
However, still trying to figure out, why the delay isn't working like it should..

Answer Source

This is extremely late as I found this post looking for something else.

If you are still working on this and having problems, you should look into the queue. The removeClass is not part of the queue and you need to add it to the queue to make the delay work, otherwise it just removes the class without waiting the specific time.

$(document.body).click(function () {
  $("div").queue(function () {
  $("div").queue(function () {

This example made the most sense to me. I hope that helps you as I am currently moving through a similar issue and I already solved one like this a few minutes ago :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download