var STARTINGOPACITY = 40; //Set opacity
var STARTINP = 70; //Set transparency
var SCROLLSTUP = 1; //Scroll speed, 1 is one pixel
var SCROLLSYY = 100; //Scroll time request
var reqflg = false;
// handles manual scrolling of the content //
function scrollContent(pardiv,id,sub) {
var div = document.getElementById("textslider");
var divsub = document.getElementById(sub );
var divpar = document.getElementById(pardiv);
clearInterval(div.timer);
div.style.opacity = STARTINGOPACITY * .01;
div.style.filter = 'alpha(opacity=' STARTINP ')';
var div2 = document.getElementById("textslider2");
if(div2!=null){
clearInterval(div2.timer);
div2.style.opacity = STARTINGOPACITY * .01;
div2.style.filter = 'alpha(opacity=' STARTINP ')';
}
var tem = div.innerHTML;/ /First page
tem1 = "
" tem "
";//Second page
var objheight = divpar.offsetHeight;
var divheight = div.offsetHeight;
//Determine whether scrolling is needed. If not, do not scroll.
if(objheight
if(! reqflg){
divpar.innerHTML = tem1;
reqflg = true;
div = document.getElementById("textslider");
div2 = document.getElementById("textslider2"); 🎜> //Set the height
div2.style.top = divheight-1 "px";
}
div.timer = setTimeout( function() { scrollAnimate(div,div2) }, SCROLLSYY);
}
}
function scrollAnimate(div,div2) {
//Get the top value of two sub-divs
var divtop = div.offsetTop;
//alert(divtop);
if(divtop==0){
div.style.top = "0px";
divtop = 0;
}
var div2top = div2.offsetTop;
if(div2top ==0){
div2top = 0;
div2.style.top = "0px";
}
if(divtop //No. 1 is above No. 2 Below
div.style.top = divtop - SCROLLSTUP 'px';
div2.style.top = div2top - SCROLLSTUP 'px';
//alert("div.style.top:" div .style.top "---div2.style.top:" div2.style.top ":height:" div.offsetHeight);
//Determine whether to swap positions. If the height position is equal to top, then swap
if(div.offsetTop==-div.offsetHeight){
//Set top to the bottom
div.style.top = div2.offsetHeight;
}
}else{
//No. 2 is on top and No. 1 is below
div2.style.top = div2top - SCROLLSTUP 'px';
div.style.top = divtop - SCROLLSTUP 'px';
//Determine whether to exchange Position, if the height position is equal to top then exchange
if(div2.offsetTop==-div2.offsetHeight){
//Set top to the bottom
div2.style.top = div.offsetHeight;
}
}
div.timer = setTimeout( function() { scrollAnimate(div,div2) }, SCROLLSYY);
}
// cancel the scrolling on mouseout //
function cancelScroll(pardiv,id,sub) {
var div = document.getElementById(id);
div.style.opacity = 1;
div.style.filter = 'alpha(opacity =100)';
clearTimeout(div.timer);
var div2 = document.getElementById("textslider2");
if(div2!=null){
div2.style .opacity = 1;
div2.style.filter = 'alpha(opacity=100)';
clearTimeout(div2.timer);
}
}