Install Widget Slide Image or Slide Ads With Javascript

Install Widget Slide Image or Slide Ads With Javascript - This tutorial appropriate for you who attended several of affiliate online stores. You will get trouble enough when it had to put up more than 1 piece of banner or widget. It might your blog cluttered with banner ads. For that then, I look for ways to put some banners or affiliate advertising widgets that do not meet the blog. To create a widget like that, I finally found the image slider with navigation and then I modified it so that it looks like Amazon widget animated, this is valid HTML5 widget.


Who wants to try it, please use the code below. Copy the CSS and Keep on top of the code </style> or ]]></b:skin>.

.che-slideshow{overflow:hidden;position:relative;margin:0 auto;width:300px;height:250px!important}
.che-slideshow-slide,.che-slideshow-slide img{width:100%;height:100%}
.che-slideshow-slide{top:0;position:absolute}
.che-slideshow-slide.inactive{display:none}
.che-slideshow-slide.position-left{top:0;left:-100%}
.che-slideshow-slide.position-right{top:0;right:-100%;position:absolute}
.slideshow-control{height:25px;cursor:pointer;position:absolute;bottom:0;width:25%;background:rgba(255,255,255,.6);z-index:1;color:#000}
.slideshow-control.slideshow-left-control{left:0}
.slideshow-control.slideshow-right-control{right:0}
.slideshow-control:hover .slideshow-arrow{opacity:1}
.slideshow-control .slideshow-left-arrow{left:50px;height:25px;margin-top:0;opacity:.6;position:absolute;top:5px}
.slideshow-control .slideshow-right-arrow{right:50px;height:25px;margin-top:0;opacity:.6;position:absolute;top:5px}
.slideshow-indicator-container{left:50%;list-style:none;margin-left:-30%;padding-left:0;position:absolute;text-align:center;bottom:-10px;width:60%;z-index:15}
.slideshow-indicator-container .slideshow-indicator{background-color:rgba(255,255,255,1);border-radius:5px;display:inline-block;height:8px;width:8px;padding:0!important;line-height:1em}
.slideshow-indicator-container .slideshow-indicator.inactive-indicator{background-color:rgba(255,255,255,.5)}

.slideshow-control to set the background and color of buttons next and prev .
.slideshow-indicator-container .slideshow-indicator to regulate navigation ( point ) and mark the active banners .
.slideshow-indicator-container .slideshow-indicator.inactive-indicator to regulate navigation ( point) to mark the banner inactive.

The next step you can put the code below on HTML/Javascript box. Save the gadget HTML/JavaScript in sidebar.

<div class="che-slideshow">
  <ol class="slideshow-indicator-container">
  <li class="slideshow-indicator">
  </li>
  <li class="slideshow-indicator inactive-indicator" >
  </li>
  <li class="slideshow-indicator inactive-indicator" >
  </li>
  <li class="slideshow-indicator inactive-indicator" >
  </li>
      <li class="slideshow-indicator inactive-indicator" >
  </li>
      <li class="slideshow-indicator inactive-indicator" >
  </li>
  </ol>
      <div class="slideshow-left-control slideshow-control">
           <i class="fa fa-chevron-left slideshow-left-arrow slideshow-arrow"></i>
      </div>
      <div class="slideshow-right-control slideshow-control">
          <i class="fa fa-chevron-right slideshow-right-arrow slideshow-arrow"></i>
      </div>
  <div class="che-slideshow-slide">
  <a href="#" rel="nofollow" target="_blank" title="handphone-tablet"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYItVpTpE2eUq76va_pBq2nf8SI7A46GO7Ntn7PB6pxfL3-sRAdQYeGjegDOI0xzrXzCEKqjijkketRxEU-lQeLCD8VVjZpOhTt3bhPv2puLk8W_VZ1VIz1eT6ZNqSbgnzEpN-bFUMXgmU/s1600/banner_1.jpg" alt="handphone-tablet" title="handphone-tablet" width="300" height="250" /></a>
  </div>
  <div class="che-slideshow-slide inactive">
  <a href="#" rel="nofollow" target="_blank" title="handphone-tablet"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtHtRakdzzhNM8bo9USBiLBZbAHVJwgNiBKl2t87XQ89dRKtyiGhWgbX_dxgCcN7JT7EjY4YozWyZKoHfmuy2oRYEaXnYEhQJAinSaXs8y3J9gmYKQGcnf3KAo4utv2ogHYz30XIsS_X2J/s1600/banner_1a.jpg" alt="camera" title="camera" width="300" height="250" /></a>
  </div>
  <div class="che-slideshow-slide inactive">
  <a href="#" rel="nofollow" target="_blank" title="handphone-tablet"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjziKZHJ7n8wh7YAN7ZOe41_YukOttNLDqMEQuZeZxpH86Hyzo2u4nCKzpWgujv4mghjK4fpF9XJCc1yyS57dvLsIVzKidqCi9bX84VAh6gZfCF1txS5gVewT7Wd0LaBc0p6s3cnRCCtLa5/s1600/banner_2.jpg" alt="handphone-tablet" title="handphone-tablet" width="300" height="250" /></a>
  </div>
  <div class="che-slideshow-slide inactive">
  <a href="#" rel="nofollow" target="_blank" title="handphone-tablet"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKv9tRo8xJH53sgXbBvA1mK9tFgs59bckXCPMbZg02TD7vnsUqgyrPH2ace9MFu7MaeH-mtjTW1ox88siKO6V7cV3AadAnyhb9FBzuZUxBkCe8F_hGyGQHbBL4B4a_JmBgYzXT4rH_4yXI/s1600/banner_2a.jpg" alt="handphone-tablet" title="handphone-tablet" width="300" height="250" /></a>
  </div>
    <div class="che-slideshow-slide inactive">
  <a href="#" rel="nofollow" target="_blank" title="handphone-tablet"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPFZ0qA1fYqKjQxQI4ceook8j03RjGUEoCBrohCVIyb35tjDVHLxqzo6KzhtMlBi_Ww7-PlfCodOH4qzbxriM7elmK_DNS2fQD52Qx8xdseX1MEjoDDEE2gMNHlB15xHUTZYH2eI7hDweJ/s1600/banner_3.jpg" alt="handphone-tablet" title="handphone-tablet" width="300" height="250" /></a>
  </div>
    <div class="che-slideshow-slide inactive">
 
<a href="#" rel="nofollow" target="_blank" title="handphone-tablet"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB0Tw87tXz9RHlXQHmeusx51guuAsHYNrxNf9-sAG3l3kystLSMtUywlk8Cwen5BbiuGVXgNymJ-UdY-L6QtgJHnRQ4XYADavv98Tka74PIlT3Mf3jR_rbbgYStThglFnA_crIx5nBSxr7/s1600/banner_3a.jpg" alt="handphone-tablet" title="handphone-tablet" width="300" height="250" /></a>  </div>  </div>
I am marking code please replace with your ad banner code , can image with a link or iframe, can be increased or decreased in number according to the number of banner you want to install.

And to sum <li class="slideshow-indicator inactive-indicator" ></li> please adjust the number of banners that you post.

The last step is you should put Javascript below, then save this javascript code above the </body>. However, because this widget uses Font Awesome icon, then make sure you have installed the CSS Font Awesome on your blog.

<script type="text/javascript">
//<![CDATA[
var CHESLIDESHOW=function(){function e(e){return c?!1:(c=!0,d=e,t(e),v[a].classList.add("inactive-indicator"),v[newSlideIndex].classList.remove("inactive-indicator"),s.style.left="prev"===d?"-100%":"100%",l.style.left="0%",s.classList.remove("inactive"),n(s),void n(l))}function t(){"prev"===d?newSlideIndex=void 0===r[a-1]?o-1:a-1:newSlideIndex=void 0===r[a+1]?0:a+1,l=r[a],s=r[newSlideIndex]}function n(e){function t(){l.classList.add("inactive"),s.style.left="0%",clearInterval(i),a=newSlideIndex,c=!1}var n=0,i=setInterval(function(){e.style.left="prev"===d?parseInt(e.style.left)+2+"%":parseInt(e.style.left)-2+"%",n++,n>=50&&t()},7)}function i(){var e=document.getElementsByClassName("che-slideshow")[0];e.style.height=getComputedStyle(r[a]).height}var l,s,d,o=6,a=0,c=!1,r=document.getElementsByClassName("che-slideshow-slide"),v=document.getElementsByClassName("slideshow-indicator");return window.onload=i,window.onresize=i,{nextSlide:function(){e("next")},prevSlide:function(){e("prev")}}}();!function(){var e=document.getElementsByClassName("slideshow-left-control")[0],t=document.getElementsByClassName("slideshow-right-control")[0];e.addEventListener("click",CHESLIDESHOW.prevSlide),t.addEventListener("click",CHESLIDESHOW.nextSlide)}();
//]]>
</script>

Install Widget Slide Image or Slide Ads With Javascript was successfully appear on your blog. Please share this article to your friends.
Advertisement

Tidak ada komentar