Hi everybody!
I’m writing because I’m facing an issue with the topics module for the first time:
on desktop it works properly but on mobile an “+” appears near the title of the post and the list of topics doesn’t appear.
Here the link where you can see it:
Can somebody help me to understand how to solve the problem?
Thanks to everybody!
Hi @EricaFontimedia ,
Did you remove some sort of post listing from the sidebar or even just a ‘blog-sidebar-post-listing’ class (I think it might supposed to be on the recent posts section)? A JavaScript error is occurring because “.blog-sidebar-post-listing” doesn’t exist for the event listener to be added to it and since the topic listing event listener occurs after that it’s not getting a chance to run. This is the JavaScript in question that’s causing an error, the “postListing.addEventListener” line:
document.addEventListener("DOMContentLoaded", function(event) {
var element = document.querySelector('.blog-sidebar');
function resize() {
if (window.innerWidth < 768) {
element.classList.add('mobile');
} else {
element.classList.remove('mobile');
}
}
window.onload = resize;
window.onresize = resize;
var topicListing = document.querySelector('.blog-sidebar-topic-filter h3');
var topicListingSidebar = document.querySelector('.blog-sidebar-topic-filter');
var postListing = document.querySelector('.blog-sidebar-post-listing h3');
var postListingSidebar = document.querySelector('.blog-sidebar-post-listing');
postListing.addEventListener('click', function (event){
postListingSidebar.classList.toggle ('clicked');
});
topicListing.addEventListener('click', function (event){
topicListingSidebar.classList.toggle ('clicked');
});
});
I think if you just add “blog-sidebar-post-listing” as a class to the <div class=“block”> around your recent posts section it should fix the issue.
Hi Alyssa, I’ve just checked in the revision history and no, this class had never been present in the index template.
So i suppose it’s an error made by HubSpot developer (this is the result of a template migration).
I’m not so confident with Javascript so I can’t understand: which is the correct class I have to put in the code?
PS: now I’m facing the same issue with the “top posts” module.
I’m seeing it working on your site now, so guessing you figured it out?
In reality there is no block class in the template, nor in the module, so I can’t edit it.
Anyway I’ve tried in the page inspector and it seems not working. 
Whatever changes you made, the dropdowns are now working on my end. Unless your problem is that you don’t want the dropdown functionality at all?
I don’t know, I’m still not seeing them, not in the english, nor in the italian page,but anyway only on modile version.
If you click on “Topics” do the topics appear? That’s what the “+” is for, these boxes have a ‘dropdown’ functionality on mobile wherein clicking the title makes the contents appear.
No, the plus does nothing but anyway I’ve never seen the topic listing completely closed but always with a “see more” link after a set number of items set in the module.
I’m now noticing that it is working properly in blog posts but not in listing.
Problem solved!
Apparently the Javascript code was causing the problem because it was not necessary. in fact the blog post was working fine without it.
I’ve deleted it: I only hope it was not necessary for something that I’m not seeing at the moment.