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

jQuery - condition for if this or this

0 votes
11 views
added Nov 22 in jQuery by LC Marshal Lieutenant (14,830 points)
var dfpElemPre  = '#div-gpt-ad-',
    dfpId       = '1542356449390-0', // sto id
    dfpElemPost = '_ad_container',
    dfpStoFront     = '.sto-ads' + ' ' + dfpElemPre + dfpId + dfpElemPost,
    dfpStoNotfront     = '.sto-ads' + ' ' + dfpElemPre + dfpId;
    
if(($(dfpStoFront).length) || ($(dfpStoNotfront).length)){
        $('.sto-ads').show();
        $('.sto-ads .slide-close').on('click', function(){
          $(this).parent().parent().removeClass('in');
        });

        if ($('body').hasClass('front')) {
          setTimeout(function(){
            $('.sto-ads').addClass('in');
          },300);
          console.log('front');
        }
        else {
          // condition for not-front 
          setTimeout(function(){
            $('.sto-ads').addClass('in');
          },300);
          console.log('not-front');
        }
      }
  console.log('create cookie');
}
else {
  $('.sto-ads').hide();
  console.log('cookie is working');
}

 

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.
...