Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - banderole ad & trigger

0 votes
23 views
added Nov 13 in jQuery by LC Marshal Lieutenant (14,830 points)
<!-- banderole ads -->    
<div class="banderole">   
  <div class="banderole-content">   
    <span class="slide-close"><i class="ion-close"></i></span>    
    <div class="slide-trigger">   
      <div id='div-gpt-ad-xxxxxx77104045-0'></div>   
      <script>    
        googletag.cmd.push(function() {     
          googletag.display('div-gpt-ad-xxxxxx77104045-0');    
        });   
      </script>         
    </div>    
    <div class="slide-trigger trigger"></div>     
     <!-- /xxxxx1612/ListDev_Banderole -->
    <div id='div-gpt-ad-xxxxx75954162-0'></div>   
    <script>    
      googletag.cmd.push(function() {     
        googletag.display('div-gpt-ad-xxxxx75954162-0');    
      });       
    </script>   
  </div>    
</div>

<script>
 $(window).load(function() {
    var banderoleAd = $(".banderole-content > div[id^='div-gpt-ad']");
    if(banderoleAd.length > 0){
      $('.banderole .slide-trigger').addClass('on');

      $('.banderole .slide-trigger.trigger').on('click', function(){
        $(this).parent().parent().toggleClass('in');
      });
      $('.banderole .slide-close').on('click', function(){
        $(this).parent().parent().removeClass('in');
      });

      setTimeout(function(){
        $('.banderole').addClass('in');
      },300);
    }
 });

 $(window).scroll(function() {
    var banderole = $('.banderole');
    if(banderole.hasClass('in')){
      banderole.removeClass('in');
    }
 });
</script>

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...