Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1255168
    Rad
    Moderator

    Hi there,

    Please change it to this,

    jQuery( function($){
    
    var the_interval = 0;
    
    the_interval = setInterval( function() {
    
    $('body').stop().animate( { 'margin-top' : $('#cp-cp_id_1b4a0:visible').height() } );
    
    if ( $('#cp-cp_id_1b4a0:visible').height() <=0) clearInterval( the_interval );
    
    } , 1000 );
    
    $('.ib-close').on('click', function(){
    
    clearInterval( the_interval );
    
    $('body').stop().animate( { 'margin-top' : 0 } );
    
    } );
    
    } );

    That should do it now. Cheers!

    #1255488
    SEVERO
    Participant

    You’re a genius! The gap below the ad isn’t closed instantly when resizing like it was but pretty damn good!

    I have two more questions regarding the Info Bar.
    1. If the Info Bar is empty, is there a way to detect that with a script?
    2. In the Info Bar settings you have Behahavior > Repeat Control > Do Not Show After Closing. If I set this for 1 day the ad will disappear for 24hrs which is fine but is there a way to keep ‘Enable Toggle Button’ to stay there when the ad isn’t? Because the moment you enable ‘Do Not Show After Closing’ you lose it.

    Should I start a new thread?

    #1255864
    Rad
    Moderator

    Hi there,

    You can change the value 1000, it’s equivalent to 1 second (1000ms). It’s the delay so it won’t freeze, but you can lower its value like 500 or 300 to make it instant. Don’t lower it to lower than 300 or it will freeze.

    1. Depending on what content to check, usually it can be detected by this condition

    if ( $('.the_selector:empty').length > 0 ) {
    //It's empty
    }

    2. You’ll have to add your own custom trigger, example let’s say you created this button

    <a href="#open_ads" class="open_ads">Open Ads</a>

    Then in your info bar setting under Behavior > Manual Display > Launch With CSS Class, add open_ads. Then just style your button to appear on top. Like this

    .open_ads {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 9999999;
    }

    Hope this helps.

    #1258751
    SEVERO
    Participant

    Hi there, figured out another solution regarding the toggle button and that was to run two Info Bars. One with the settings of ‘Do Not Show After Closing for 1 day’ and the other with the ‘Initially Display Toggle Button’ loaded.

    The resizing has been working on and off for me and now it doesn’t seem to be working at all.

    #1260155
    Rad
    Moderator

    Hi there,

    There are 10 javascript errors in which weren’t there before. Would you mind removing all other custom javascript, this should remain there

    jQuery( function($){
    
    var the_interval = 0;
    
    the_interval = setInterval( function() {
    
    $('body').stop().animate( { 'margin-top' : $('#cp-cp_id_1b4a0:visible').height() } );
    
    if ( $('#cp-cp_id_1b4a0:visible').height() <=0 ) clearInterval( the_interval );
    
    } , 1000 );
    
    $('.ib-close').on('click', function(){
    
    clearInterval( the_interval );
    
    $('body').stop().animate( { 'margin-top' : 0 } );
    
    } );
    
    } );    

    I added it on developer console and it’s perfectly working, there are other javascripts that affects this one.

    Thanks!

    #1260160
    SEVERO
    Participant

    Hi there, yes had tried that with no success. I’ve left only the code above so you can see

    #1260500
    Rad
    Moderator

    Hi there,

    Thanks, and finally, this is the one that causing it

    <script>
    addToHomescreen({
       startDelay: 5
    });
    </script>

    The addToHomescreen is not defined, not even existing from this file http://www.mad-daily.co.nz/add2home.js

    You may correct or remove them. Thanks!

    #1260547
    SEVERO
    Participant

    Hi there, little confused to why it was working fine before. Have removed that script and no joy 🙁

    #1260687
    Rad
    Moderator

    Hi there,

    I checked and it’s now working after removing it. Please clear your browser cache before testing.

    There are 6 other errors which are connected to youtube media element. But it shouldn’t affect your site’s functionality.

    I went ahead and changed the code to this,

    
       
    
    jQuery( function($){
    
    var the_interval = 0;
    
    the_interval = change_height();
    
    $('.ib-close').on('click', function(){
    
    clearInterval( the_interval );
    
    $('body').stop().animate( { 'margin-top' : 0 } );
    
    } );
    
    $('.cp-ifb-toggle-btn').on('click', function() {
    
    the_interval = change_height();
    
    } );
    
    function change_height () {
    
    return setInterval( function() {
    
    if ( $('#cp-cp_id_1b4a0:visible').height() <=0 ) $('body').stop().animate( { 'margin-top' : 0 } );
    else $('body').stop().animate( { 'margin-top' : $('#cp-cp_id_1b4a0:visible').height() } );
    
    } , 300 );
    
    }
    
    } );    

    The issue was that your newly added toggle doesn’t re-initialize the interval. The code should fix it all.

    Cheers!

    #1261522
    SEVERO
    Participant

    Thank you so much for your time. Works perfectly 🙂

    #1261697
    Nico
    Moderator

    Happy to hear that.

    Feel free to ask us again.

    Thanks.

    #1265952
    SEVERO
    Participant

    Hi there, seem to having an issue with the Scroll Top Anchor. When I remove the code above it works fine. Any solutions around this?

    Thanks

    #1266454
    Rad
    Moderator

    Hi there,

    Yes, the code disables all scrolling with 300ms interval,

    $('body').stop()

    Unfortunately, you can’t have both, since stopping the scrolling is required for smooth transition of your ads.But, you may try removing the stop(). Example, from this

    $('body').stop().animate

    to this

    $('body').animate

    Hope this helps.

    #1280345
    SEVERO
    Participant

    Hi there, yes unfortunately these don’t work together. Will have to disable the Scroll Top Anchor 🙁

    #1280357
    SEVERO
    Participant

    Now this code isn’t working. Not resizing??

    jQuery( function($){

    var the_interval = 0;

    the_interval = change_height();

    $(‘.ib-close’).on(‘click’, function(){

    clearInterval( the_interval );

    $(‘body’).stop().animate( { ‘margin-top’ : 0 } );

    } );

    $(‘.cp-ifb-toggle-btn’).on(‘click’, function() {

    the_interval = change_height();

    } );

    function change_height () {

    return setInterval( function() {

    if ( $(‘#cp-cp_id_1b4a0:visible’).height() <=0 ) $(‘body’).stop().animate( { ‘margin-top’ : 0 } );
    else $(‘body’).stop().animate( { ‘margin-top’ : $(‘#cp-cp_id_1b4a0:visible’).height() } );

    } , 300 );

    }

    } );

  • <script> jQuery(function($){ $("#no-reply-1240219 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>