JQuery Sort applied to table rows makes rows taller

I am preparing custom positioning for table rows with jQuery UI Sortable, but I am facing a serious problem. Whenever I grab a row, it reaches a height of 2px . However, margin, height, filling, etc. Remain unchanged. I created a test page without any additional scripts or styles. Can I do everything to prevent such lines from appearing? Thanks.

jQuery: 1.4.4, jQuery UI: 1.8.9

Edit: this happens on Chrome and Safari (not tested by other browsers) on Mac. This jsFiddle example works fine: http://jsfiddle.net/yA47C/ , but I'm not quite sure what might be there.

 <!DOCTYPE html> <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> </head> <body> <table> <thead> <tr><th>header</th></tr> </thead> <tbody class="sortable"> <tr><td>row 1</td></tr> <tr><td>row 2</td></tr> <tr><td>row 3</td></tr> <tr><td>row 4</td></tr> <tr><td>row 5</td></tr> </tbody> </table> <script> $(function() { $(".sortable").sortable(); }); </script> </body> </html> 
+4
source share
1 answer

I don't know what the problem is (as it works for me), but if it works for you in jsfiddle, this is definitely one of these css rules in normalize.css that fixes it for you:

http://fiddle.jshell.net/css/normalize.css

 body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset input,textarea,p,blockquote,th,td { margin:0; padding:0; } table { border-collapse:collapse; border-spacing:0; } fieldset,img { border:0; } address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; } ol,ul { list-style:none; } caption,th { text-align:left; } h1,h2,h3,h4,h5,h6 { font-size:100%; font-weight:normal; } q:before,q:after { content:''; } abbr,acronym { border:0;} 

If I were to guess, I would say that this is a "table" rule. There may also be a td rule.

+2
source

Source: https://habr.com/ru/post/1337014/


All Articles