function addevent ( elem , eve , func ) { if( window.addeventlistener ) { elem.addeventlistener( eve , func ) } else { elem.attachevent( 'on' + eve , func ) } }; function getclass ( elem ) { if( document.getelementsbyclassname ) { return document.getelementsbyclassname( elem ); } else { var all = document.getelementsbytagname( '*' ) , class_node = []; for( var i = 0 ; i < all.length ; i++ ) { if( all[ i ].classname.indexof( elem ) > -1 ) { class_node[ class_node.length ] = all[ i ]; } } return class_node; } } function children ( elem ) { var child_node = elem.getelementsbytagname( '*' ) , child = []; for( var i = 0 ; i < child_node.length ; i++ ) { if( child_node[ i ].parentnode == elem ) { child[ child.length ] = child_node[ i ]; } } return child; } function getelem ( elem ) { if( elem[ 0 ] == '#' ) { return document.getelementbyid( elem.split( '#' ).pop() ); } else { return getclass( elem.split( '.' ).pop() )[ 0 ]; } } function scrolltop ( natrue ) { var elem = getelem( natrue.name ); var elem_child = children( elem )[ 0 ]; var length = children( elem_child ).length , height = elem_child.offsetheight , html = elem_child.innerhtml; elem_child.innerhtml += elem_child.innerhtml; function getheight () { var timers = setinterval( function () { height = elem_child.offsetheight / 2; if( height > 100 ) { clearinterval( timers ); } } , 50 ); } getheight(); function roll () { if( ( elem.scrolltop += natrue.ani ) >= height ) { elem.scrolltop = 0; } } var timer = setinterval( roll , natrue.spend ); function stop () { function change() { getheight(); if(window.innerwidth <= natrue.stop) { clearinterval(timer); elem.scrolltop = 0; elem_child.innerhtml = html; } else { clearinterval(timer); elem_child.innerhtml = html + html; timer = setinterval(roll, natrue.spend); } } change(); addevent( window , 'resize' , change ); } natrue.stop && stop(); elem.onmouseenter = function () { clearinterval( timer ); } elem.onmouseleave = function () { clearinterval( timer ); timer = setinterval( roll , natrue.spend ); } }