HTML section:
<DivID= "banner"> <!--4 scrolling Pictures - <DivID= "Inside"> <imgsrc=".. /.. /img/14072415363339_0.jpg "><imgsrc=".. /.. /img/14072415383924_0.jpg "ID= "Img2" /><imgsrc=".. /.. /img/14072415383948_0.jpg "ID= "IMG3" /><imgsrc=".. /.. /img/14072415383951_0.jpg "ID= "Img4"/><imgsrc=".. /.. /img/14072415363339_0.jpg "ID= "Img5"/> </Div> <!--4 buttons to jump to a corresponding picture - <ulID= "Bannernum"> <binonclick= "Changebanner (1)">1</Li> <Lionclick= "Changebanner (2)">2</Li> <binonclick= "Changebanner (3)">3</Li> <Lionclick= "Changebanner (4)">4</Li> </ul> </Div>
CSS section:
<styletype= "Text/css"> *{padding:0px;margin:0px; }#banner{width:100%;Overflow:Hidden;White-space:nowrap;position:relative; }#banner #inside{width:6830px;position:relative; Left:50%;Margin-left:-683px;transition:All 1s ease; }#banner img{width:1366px; }#bannerNum{padding:0px;List-style:None;Overflow:Hidden;width:160px;position:Absolute;Bottom:30px; Right:50px; }#bannerNum Li{width:30px;Height:30px;Background-color: White;text-align:Center;Line-height:30px;margin:0px 5px;float: Left;cursor:Pointer; } </style>
Native JS section:
<script>varnum = 1; varinside; Window.onload=function() {inside= document.getElementById ("Inside"); varInterval = SetInterval (function() {inside.style.transition= "all 1s ease"; Num++; Switch(num) { Case1: Inside.style.transition= "None"; Inside.style.marginLeft= ( -683) + "px"; Break; Case2: Inside.style.marginLeft= ( -683-1366) + "px"; Break; Case3: Inside.style.marginLeft= ( -683-1366*2) + "px"; Break; Case4: Inside.style.marginLeft= ( -683-1366*3) + "px"; Break; Case5: Inside.style.marginLeft= ( -683-1366*4) + "px"; Num= 0; Break; default: Break; } },2000); } functionChangebanner (NUM1) {inside.style.transition= "None"; Switch(NUM1) { Case1: Inside.style.marginLeft= ( -683) + "px"; Break; Case2: Inside.style.marginLeft= ( -683-1366) + "px"; Break; Case3: Inside.style.marginLeft= ( -683-1366*2) + "px"; Break; Case4: Inside.style.marginLeft= ( -683-1366*3) + "px"; Break; default: Break; } num= Num1-1; } </script>
Native JS implementation of banner graph scrolling and jumping