【问题标题】:Twenty Thirteen and sidebar overflows footer - Top Margin二十三和侧边栏溢出页脚 - 上边距
【发布时间】:2014-09-09 16:55:37
【问题描述】:

我一直试图阻止侧边栏溢出 Wordpress 4.0 中二十三岁的子主题中的页脚。

我添加了我在另一个网站上的另一个帖子中找到的以下 CSS 代码。

CSS:

/* Fix Sidebar Overlaping Footer*/

.sidebar .entry-header, .sidebar .entry-content, .sidebar .entry-summary, .sidebar .entry-meta {
   padding: 0px 20px 0px 20px;
   max-width: 100%;
}

.sidebar .site-footer .widget-area {
    max-width: 1040px;
    left: 0px;
    margin-top:10px!important;
}

.hentry {
   padding: 20px 0px;
}

@media (min-width: 999px) {

   #main {
      overflow: hidden;
      margin: 0px auto;
      max-width: 1080px;
   } 

   #primary.content-area {
      width: 68%;
      float: left;
   }

   .site-main .sidebar-container {
      position: static;
      float: right;
      width: 30%;
      height: auto;
   }
   .site-main .widget-area {
      margin-top: 24px;
      margin-right: 20px;
   }

}

问题是有 javascript (functions.js in twothirteen/js) 为页脚添加了巨大的上边距,您可以在此处看到结果:http://tcsdesignreno.com/addnv/

Javascript:

/**
     * Adds a top margin to the footer if the sidebar widget area is higher
     * than the rest of the page, to help the footer always visually clear
     * the sidebar.
     */
    $( function() {
        if ( body.is( '.sidebar' ) ) {
            var sidebar   = $( '#secondary .widget-area' ),
                secondary = ( 0 === sidebar.length ) ? -40 : sidebar.height(),
                margin    = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;

            if ( margin > 0 && _window.innerWidth() > 999 ) {
                $( '#colophon' ).css( 'margin-top', margin + 'px' );
            }
        }
    } );

有没有人可以阻止侧边栏与页脚重叠或阻止 js 添加上边距的解决方案?我知道我以前做过,但我似乎找不到正确的代码组合。

提前致谢,

马特

【问题讨论】:

    标签: javascript css wordpress sidebar


    【解决方案1】:

    嗯,本质上,你为我回答了这个问题。

    .js 中为顶部边缘创建 css 的行的 ID 为 #colophon

    我将这一行添加到我的子主题 css 中,它负责 margin-top:

    #colophon {margin-top:0 !important;}

    【讨论】:

    • 这不能回答问题
    猜你喜欢
    • 2013-08-27
    • 2015-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-12
    • 1970-01-01
    • 2014-05-16
    相关资源
    最近更新 更多