WordPress.org

Support

Support » Themes and Templates » Widgets overlapping in sidebar – Max Magazine

Widgets overlapping in sidebar – Max Magazine

  • When the page initially loads, the widgets on the sidebar appear to be overlapping. See here:

    http://cds.aaronkelchner.com/

    However, when you resize the window and make it smaller (so the responsive design kicks in), and then full screen the window again, the widgets are fine.

    I’ve found it doesn’t matter which widgets I’m using, even the widgets that come with the Max Magazine template (Facebook, etc.).

    Any ideas of what could be causing it?

Viewing 15 replies - 1 through 15 (of 42 total)
  • WPyogi

    @wpyogi

    Forum Moderator

    Using absolute positioning is messing those up — it’s causing the Facebook widget to sit on top of the Twitter one. Try using Firebug to work with the CSS code in the area of the page.

    Thanks so much for your response!

    I’ve done some fiddling with it, and it appears to be something with the Max Magazine theme itself. I’ve mixed and matched various different widgets and it happens the same no matter what widget I use. I’ve also tested out the exact same widgets on different themes, and there are no overlapping issues.

    I have limited experience with CSS, and after looking into it, I’ve been trying to edit the #sidebar .widget section, since it seems to be universal to all widgets (as opposed to individual widgets). These are the default rules:

    #sidebar .widget{
    	padding-bottom: 20px;
    	margin-bottom:20px;
    	width:280px;
    	overflow:hidden;
    }

    There doesn’t seem to be any rule telling it to be an absolute positioning. Even after adding “position: relative;” as a rule, it does nothing to change it. So, I’m assuming, there is something else I’m missing.

    It’s odd that after you resize the window to make it smaller, and then resize it back to full screen, everything snaps in place just fine. I’d like it to just do that upon initial loading.

    EDIT: And of course after I said that, I thought to look at what the code looks like in Firebug once I’ve resized the window, but the only difference is that the “top” value for the absolute positioning changes to fit perfectly, instead of on top of each other.

    So basically, something other than the stylesheet is telling the widgets to do absolute positioning and assigning them a “top” value that I’m not quite sure how to manipulate.

    WPyogi

    @wpyogi

    Forum Moderator

    It’s in the HTML code here:

    <div id="max_magazine_facebook_widget-2" class="widget widget_facebook masonry-brick" style="position: absolute; top: 1106px; left: 0px;">

    Using iframes is not ideal either. Also make sure you are validating the site for errors:

    http://codex.wordpress.org/Validating_a_Website

    Thank you again for your responses, and I’ll definitely be validating the website for errors.

    I saw that line when I was looking at it in Firebug, but I’m not sure how to edit that. As I said, nowhere in theme’s CSS does it tell widgets to have absolute positioning (nor in the CSS of the individual widget plug-ins), so I don’t know why the page is loading like that.

    Also, there are no IDs or Classes existing in the theme’s stylesheet that the DIV you posted above is referencing. I’m assuming the masonry-brick is referencing jQuery Masonry, so could it have something to do with that?

    WPyogi

    @wpyogi

    Forum Moderator

    Yes, and that would explain why it moves — if the javascript is setting the CSS code, there can be a delay until it loads or reloads…

    But I’m not familiar with that plug-in so can’t be of much specific help on that.

    Yep, I took out the Masonry JS code from the functions.php, and sure enough the problem isn’t there anymore. However, it’s there so that when a mobile device loads the page, the widgets at the bottom stack nice and neatly without gaps. So without Masonry, it doesn’t look as nice in mobile view. At least I’ve narrowed it down significantly. Thanks again for all of your help WPyogi. You’ve pushed me in the right direction.

    Is there anyone that has worked with the Max Magazine theme and been able to fix this issue with jQuery Masonry?

    Theme Author Sami

    @gazpo

    Sorry guys, thats problem is sometimes caused by the Masonry plugin. You can simply disbale the plugin from the functions.php (just remove the line following line from the functions.php file:

    wp_enqueue_script('masonry', get_template_directory_uri() . '/js/jquery.masonry.min.js', array('jquery'));

    Theme Author Sami

    @gazpo

    @projectperception
    Yes, the idea was that the widgets display nicely without any gaps in the responsive view. You can perhaps include the masonry script only if its being viewed on the mobile devices.

    Thanks so much for the clarification, Sami.

    That’s a good idea. I’ll try only enabling it for mobile devices next. For now, I’ve just assigned absolute height values to each of the widgets, which seems to put everything in place correctly on Chrome, Firefox, and IE at least.

    Also, I originally tried to disable the plugin by removing that line in functions.php, but it also disabled the homepage slider. I triple checked to make sure that was the only line I removed, and after removing it all that appears is the small loading circle. Does the slider rely on anything in Masonry?

    Theme Author Sami

    @gazpo

    No, slider does not rely on masory. Only sidebar widgets use it. Everything should work fine without masonry. You should remove its configuration settings from the js/custom.js file.
    Open custom.js file and remove this:

    jQuery('#sidebar').masonry({
    itemSelector: '.widget'
    });

    It should work. If it still does not work, let me know and I can look further.

    I’m having the same problem but am hacking my way through this with only minimal html/css knowledge. Can you tell me where to find the custom.js file? Many thanks!

    I’ve searched all of the js files in my control panel for this bit of code but cannot find it. Am I looking in the wrong spot?

    Forget that, I found it. Such a noob, sorry! haha

    Hi Projectperception i want to ask u how to make the widget on Max Magazine theme not overlapping?

    The way that I worked around it was go into the CSS of the each widget and gave them a specific height value. It really only works with widgets that don’t alter in size based on the content in them

    So the widgets I had trouble with were ones that come from plugins (like my Twitter and Facebook widgets and a fancier Recent Post widgets). From the Dashboard, I went to Plugins -> Editor and in the top right there is a drop down selector for the plugins to edit, and I selected the one I wanted to adjust.

    Usually a plugin has a .css file associated with it. I clicked on that, and added a “height: XXXpx;” line in the top level element of the css stylesheet. For example, my Smart Recent Posts plugin looked like this before:

    .smart_post { 
    
    width: 280px;
    
    }

    But then I added the height line, based on how large it is on the screen.

    .smart_post { 
    
    width: 280px;
    height: 650px;
    
    }

    This seems to push the widgets under it and in place. I’m sure it’s not the best way to do it, but I found it to be the easiest without disabling Masonry altogether. I did this to each individual plugin widget I was using (only about 4). I hope this helped and made sense.

Viewing 15 replies - 1 through 15 (of 42 total)
  • The topic ‘Widgets overlapping in sidebar – Max Magazine’ is closed to new replies.