Jquery achieves a combination effect similar to that of image and text switching on the right

Source: Internet
Author: User

Finally, the company's press conference was completed. It is said that the response was good. There were more than 70 media outlets, and the competition was quite large.
Now we have to go back to development. The new version of the mall needs to be revised, and the style structure and browser compatibility of the major sections have been completed. Although there is a tangle of IE6, we still win the game, no way. You know, the process is hard.
The javascript effect of the entire text and text can be combined tomorrow, which reminds the jquery blog of the effect similar to that of the image and text switching function used in the previous version.
$ (Function (){
$ (". Recommend. info # tabnav li"). Each (function (INDEX ){
$ (This). Hover (function (){
$ ("# Tabcon> Li: visible"). Hide ();
$ ("# Tabcon> Li: eq (" + index + ")"). Show ();
$ (This). addclass ("On"). siblings (). removeclass ("On ");
})
})
// Gocomment
$ ("# Gocomment"). Click (function (){
$ ("HTML, body"). animate ({scrolltop: $ (". Goods-comment"). offset (). Top}, 10 );
})
$ ("Ul. list-shows em. ICO: GT (8) "2.16.css ({" text-indent ":" 3px "," font-size ":" 10px ", "-WebKit-text-size-adjust": "NONE "});
// List-shows
$ (". List-shows Li"). Hover (function (){
$ (This). addclass ("On"). siblings (). removeclass ("On ");
})
$ (". Sift-goods-list ul. Fix li"). Click (function (){
$ (This). addclass ("On"). siblings (). removeclass ("On ");
});
VaR othergoods = $ (". Sift-goods-con. Other ");
$ (". Sift-goods-BTN a"). Toggle (function (){
Othergoods. slideup (300 );
$ (This). removeclass ("up"). Text ("more ")
}, Function (){
Othergoods. slidedown (300 );
$ (This). addclass ("up"). Text ("collapse ")
})
// Goods-Property
VaR M = $ ('. Goods-property p img'). Is ("IMG ");
If (M = true ){
$ (". Goods-property IMG"). Parent ("p" ).css ("padding", "0 ")
}
// Tag-tynn-con
$ (". Tag-tynn-con DT. On"). Next ("DD"). Find ("ol"). Show ();
$ (". Tag-tynn-con dl dt"). Click (function (){
$ (This). toggleclass ("On"). Next (). Find ("ol"). slidetoggle (300)
});
$ (". Tag-tynn-con DL dt a"). Click (function (e ){
E. stoppropagation ();
});
// Goods-Info
$ (". Option-dl dt. option-dt.normal"). addclass ("On ");
$ (". Option-dl dt. Option-Dt: Not (. Normal)"). Click (function (){
$ (This). toggleclass ("On ");
If (! $ (This). Next (". Option-dd"). Is (": animated ")){
$ (This). Next (". Option-dd"). slidetoggle (300 );
}
});
VaR $ cur = 1;
VaR $ I = 5;
VaR $ Len = $ ('# IMG-list-con> ul. Fix> li'). length;
VaR $ pages = math. Ceil ($ Len/$ I );
VaR $ W = $ ('. Goods-Main # IMG-list-con'). Width (); // obtain the peripheral width of the display area
VaR $ Showbox =$ ('# IMG-list-con> ul. fix ');
VaR $ pre = $ ('# IMG-list. Go-Left ');
VaR $ next = $ ('# IMG-list. Go-right ');
$ Pre. Click (function (){
If (! $ Showbox. Is (': animated ')){
If ($ cur = 1 ){
}
Else {
$ Showbox. animate ({
Left: '+ =' + $ W
},500 );
$ Cur --;
}
}
});
$ Next. Click (function (){
If (! $ Showbox. Is (': animated') {// determines whether the display area is animated.
If ($ cur = $ pages ){
}
Else {
$ Showbox. animate ({
Left: '-=' + $ W
}, 500); // change the left value and switch the display Layout
$ Cur ++; // the total number of pages
}
}
});
// Goods-Main imgshow end
$ (". No-pinglun"). Click (function (){
$ ("# Pinglun"). slideup (300)
});
$ (". Want-ask"). Click (function (){
$ (". Product_zixun"). slidedown (300)
})
$ (". No-Zixun"). Click (function (){
$ (". Product_zixun"). slideup (300)
});
$ (". Pay-append dd"). Hide ();
$ ("Table. data. A-share"). Click (function (){
$ (This). Parents ("TR"). Find (". Bubble"). Toggle ();
$ (This). Parents ("TR"). siblings ("TR"). Find (". Bubble"). Hide ();
$ ("Body"). One ('click', function (){
$ (". Bubble"). Hide ();
});
Return false;
});
$ (". Bubble"). Click (function (){
Stoppropagation ()
});
$ (". Comment-Main. info. product_zonghe A. No-Re"). Click (function (){
$ (This). Parents (". product_zonghe"). slideup ();
});
/* X-15 */
Function saveclass ()
{
VaR temclassarry = new array ()
$ ("# Userstart> li"). Each (function (I ){
Temclassarry [I] = $ (this). ATTR ("class ");
})
Return temclassarry;
}
$ (Document). Ready (function (){
VaR temparray = saveclass ();
$ ("# Userstart> li"). mousemove (
Function (){
VaR currentcount = 0;
Currentcount = $ ("# userstart> li"). Index ($ (this) [0])
$ ("# Userstart> li"). Each (function (I) {if (I <= currentcount)
{
$ (This). removeclass ();
$ (This). addclass ("LV1 ");
}
Else {
$ (This). removeclass ();
$ (This). addclass ("lv2 ");
}})
})

. Click (function (){
Temparray = saveclass ();
})

. Mouseout (function (){
$ ("# Userstart> li"). Each (function (I ){
$ (This). removeclass ();
$ (This). addclass (temparray [I]);
})
})
});
});
Function selectpay (value)
{
If (value = 4)
{
$ (". Pay-Way"). slidedown (300 );
}
Else
{
$ (". Pay-Way"). slideup (300 );
}
}
Function selectopenclosed (OBJ)
{
VaR objname = $ ("#" + OBJ );
If (OBJ = "one ")
{
VaR openclass = objname. ATTR ("class ");
If (openclass. indexof ("On")>-1)
{
Objname.css ("background-position", "8px-1122px ");
Objname. Next ("DD"). slideup (300 );
Objname. removeclass ("On ");
}
Else
{
Objname.css ("background-position", "8px-1103px ");
Objname. Next ("DD"). slidedown (300 );
Objname. addclass ("On ");
}
}
If (OBJ = "two ")
{
VaR openclass = objname. ATTR ("class ");
If (openclass. indexof ("On")>-1)
{
Objname.css ("background-position", "8px-1122px ");
Objname. Next ("DD"). slideup (300 );
Objname. removeclass ("On ");
}
Else
{
Objname.css ("background-position", "8px-1103px ");
Objname. Next ("DD"). slidedown (300 );
Objname. addclass ("On ");
}
}
If (OBJ = "three ")
{
VaR openclass = objname. ATTR ("class ");
If (openclass. indexof ("On")>-1)
{
Objname.css ("background-position", "8px-1122px ");
Objname. Next ("DD"). slideup (300 );
Objname. removeclass ("On ");
}
Else
{
Objname.css ("background-position", "8px-1103px ");
Objname. Next ("DD"). slidedown (300 );
Objname. addclass ("On ");
}
}
}
Code Let's take a look at the JS implementation code.
Online effect demo

Converting from jquery http://www.jqueryba.com/355.html

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.