javascript - IE9 hover bug - Hover state stays after moving a row -
this cut down down version of actual application, bug still same...
we have table rows can moved up/down controls in row, , signify move controls have hover state. in following jsbin http://jsbin.com/asasak/1 in ie9 you'll see hover state stays after row has been moved.
any ideas? i've tried changing row's class when moved , removing class hover state still stays!
similar :hover persistent when moving dom element , tried :active solution leaving state attached element after move not good.
one way work around problem replace element instead of moving it. it's hack, has small performance impact might not want add , it's not elegant i'd have liked, working me in ie8.
$(document).ready(function(){ $('table').on('click', 'a', function(){ var $this = $(this); var row = $this.closest('tr'); var index = row.index(); var lastindex = row.siblings().length; if ($this.hasclass('up') && index === 0 || $this.hasclass('down') && index === lastindex) { return; } if ($this.hasclass('up')) { row.clone().insertbefore(row.prev()); } else { row.clone().insertafter(row.next()); } row.remove(); }); }); note: using .on() delegate click event avoids having .clone() elements events each time.
Comments
Post a Comment