Table highlighting and tooltip in HTML

Source: Internet
Author: User

In a table that needs to display a lot of data, to view a row of data more efficiently, you often need to highlight this row when moving the cursor to a row. There are many ways to achieve this effect. Here is a method:

Function setTableHover (t ){
$ (T + "tbody tr ")
. Mouseover (function () {$ (this). addClass ("hover ");})
. Mouseout (function () {$ (this). removeClass ("hover ");})
}
When you move the cursor over a row, add a highlighted css class to the row. When you move the cursor away, remove the class. It can be set for a specific table:

<Table id = "test">
</Table>
<Script>
SetTableHover ('# test ')
</Script>
You can even set all the tables on a page as highlighted:

<Script>
SetTableHover ('table ')
</Script>
In css, you need to write the hover:

. Hover {
Background: # e9cffa;
}
In addition to highlighting a row, you may need to bring up a tooltip when you move the cursor to a cell. The tooltip can be a pop-up window, that is, a div element.

<Tr>
<Td class = "tip">
Hello
<Div class = 'popup' style = 'display: none; '> this is the tip </div>
</Td>
</Tr>
To achieve this effect, you can modify the mouse event response that contains the tip class:

$ (Function (){
$ ('. Tip'). hover (
Function (){
Show_popupex ($ (this). find ("div"), $ (this ));
},
Function (){
$ (This). find ("div"). hide ();
}
);
});
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.