kimzi
asked 8 years ago

Hi!
Got an issue with the promo bar, I’m allowing the bar to get closed by users, and depending on the bar position on the front page I have to move a certain div down a little bit (fades in after the page is pushed down). I use the body class dwpb-open for this, which works fine until you refresh the page. the bar is still hidden as it should be but the class dwpb-open returns. Any insight on this? is this really how it should be working?
 
Best Regards

5 Answers
DominicStaff
answered 8 years ago

Please accept my apology for the delay in getting back to you, you can let me know detail about it, please send me your site and a screenshot for further checking. I will help you resolve it as soon as possible. 

kimzi
answered 8 years ago

Hi again!
Unfortunately the site is part of a intranet, not accessible from outside.
Here is a screenshot of the issue.
As you can see, the “dwpb-open” returns after a refresh which disorientates my navbar.
Best Regards

DominicStaff
answered 8 years ago

I have checked your image and see that the plugin when you enable the “Allow to Close PromoBar ?” option. After clicking the close button and the cookies will save in your browser. So, after refresh, the promobar will not show again. In your case, I think you should disable this option and configure look like that. 
See the screenshot: http://prntscr.com/bpe901

kimzi
answered 8 years ago

Hi again!
I’m sorry, I might not have explained correctly. I do need to have it enabled as users need to be able to close the promo.
The issue here seems to be this line of code which never runs? :

$(‘body’).removeClass(‘dwpb-open’);

can’t find the cookie dwpb-hide, though I found one with the name dwpb-close?

Best Regards

kimzi
answered 8 years ago

OK!
I think I figured it out, I added these lines to my child themes .js file.In short, this will remove the class “dwpb-open” right after it’s added if the values match.

/* If the promo bar cookie "dwpb-close" matches the reset_cookie value, remove the body class dwpb-open */

$(document).ready(function() {
if ( $.cookie('dwpb-close') === 'dwpb-close-' + dwpb.reset_cookie ) {
                setTimeout(function(){
                    $('body').removeClass('dwpb-open');
                },1200);
            }
});

Best Regards

DominicStaff
answered 8 years ago

Congratulation, If you have any issue, you can let me know, I will check and help you resolve it as soon as possible. 

Powered by DW Question & Answer Pro