About the JS code of Dangdang

Source: Internet
Author: User


/*window.onload = function () {
Get all tab tabs
var tabs = document.getElementById ("Tabsmin"). getElementsByTagName ("Li");
var contents = document.getElementById ("Newbooks_main"). getElementsByTagName ("div");

for (var i = 0;i<tabs.length;i++) {
Tabs[i].index = i;
Tabs[i].onmouseover = function () {
for (var j = 0;j<tabs.length;j++) {
Tabs[j].classname = "";
Contents[j].style.display = "None";
};
This.classname = "cur";
Contents[this.index].style.display = "block";
};
}
};*/
$ (function () {
/* Latest Shelves tab Toggle Effect */
$ ("#tabsMin li"). MouseOver (function () {
$ (this). AddClass ("cur"). Siblings (). Removeclass ("cur");
$ ("Div. Booksort"). Hide (). EQ ($ (this). Index ()). Show ();
});

Timer
var nowrow=0;
Function times () {
if (nowrow==$ ("#focus li"). length) nowrow=0;
$ ("#focus li"). EQ (nowrow). addclass ("cur"). Siblings (). Removeclass ("cur");
$ ("#focusimg"). attr ("src", "Images/dd_scroll_" + (nowrow+1) + ". jpg");
nowrow++;
}
var time=setinterval (times,1000);
Slide
$ ("#focus li"). MouseOver (function () {
$ (this). AddClass ("cur"). Siblings (). Removeclass ("cur");
$ ("#focusimg"). attr ("src", "Images/dd_scroll_" + ($ (this). Index () +1) + ". jpg");
Clearinterval (time);

});
$ ("#focus li"). Mouseout (function () {
Time=setinterval (times,1000);
});
Floating ads
$ ("#right"). css ({"Position": "Fixed", "Top": "100px"});
Turn off floating ads
$ ("#dd_close"). Click (function () {
$ (this). Parent (). Hide ();
});
/* Ads with mouse scrolling on the right image
var Rightt;
var rightr;
var objright;
var rightwidth;
function Place () {
Objright=document.getelementbyid ("right");
Rightwidth=document.getelementbyid ("right1"). Width;
if (objright.currentstyle) {//ie browser
Rightt=parseint (ObjRight.currentStyle.top);
Rightr=parseint (ObjRight.currentStyle.right);
}
Else{//firefox Browser
Rightt=parseint (Document.defaultView.getComputedStyle (objright,null). top);
Rightr=parseint (Document.defaultView.getComputedStyle (objright,null). right);
}

}

function Move () {
Objright.style.top=rightt+parseint (Document.documentElement.scrollTop + document.body.scrollTop) + "px";
Objright.style.left=parseint (document.documentelement.scrollleft+document.body.scrollleft) +parseInt ( Document.documentElement.clientWidth)-rightr-rightwidth+ "px";
document.getElementById ("Dd_close"). style.left= "63px";
}

Place ();
Window.onscroll=move;

The right side of the image to scroll with the mouse off
Objright.onclick=function () {
Objright.style.display= "None";
}*/

Drop-down menu
$ ("[alt= ' Arrow ']"). Parent (). Hover (
function () {
$ ("#dd_menu_top_down"). Show ();
},
function () {
$ ("#dd_menu_top_down"). Hide ();
}
);
Auto-scrolling Ads
$ ("#dome2"). HTML ($ ("#dome1"). html ());
function Timee () {
if ($ ("#dome2") [0].offsettop-$ ("#dome") [0].scrolltop<=0) {
$ ("#dome") [0].scrolltop-=$ ("#dome1") [0].offsetheight
}else{
$ ("#dome") [0].scrolltop++;
}
}
var start=setinterval (timee,1)
$ ("#dome"). Hover (
function () {
Clearinterval (start);
},
function () {
Start=setinterval (timee,1)
}
);

});

About the JS code of Dangdang

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.