This article mainly introduces how to use JQuery to quickly implement AJAX dynamic loading of tabs (for example ).
The implementation process is as follows:
1. Find the link source. Here is a string of links under Li.
2. Processing styles
3. When the mouse moves, load the website of The Link source to the specified container, and switch the style so that the Click Event returns false. The link source webpage should not be clicked here.
5. Over.
Script:
The Code is as follows:
{
// HomeNews
Var tid = "# homeNews"; // removeTabBold
Var lvTabs =$ (tid );
If (lvTabs! = Null)
{
LvTabs. find (""). each (function () {$ (this ). click (function () {return false ;}); $ (this ). mouseover (function (){
RemoveTabBold (tid); $ (this). addClass ("bold ");
$ (This). parent (). addClass ("lvbg ");
$ ('# HomeNewsList'). load ($ (this). href ());
Return false ;})});
}
}
Function removeTabBold (LvTabId)
{
$ (LvTabId). find ("a"). each (function (){
$ (This). removeClass ("bold ");
$ (This). parent (). removeClass ("lvbg ");
$ (This). parent (). removeClass ("lvp ");});
}