Hi all. Thanks for welcoming me to the community.
I'm currently creating a photo blog that uses fullsize page images where the body css calls for overflow:hidden (no scrollbars). On pages other than the index.php i wanted scrollbars for a more traditional blog look. The problem is on single pages of one of the categories I am getting a double scrollbars.
I can clearly see that its loading two sets of bodies in one because of the is_category and in_category being applied. Wondering if there is a way to say to take the css of the child element instead of both.
CSS: body#home, body#blog{
background: #fff url(images/bikeback.gif);
background-repeat:no-repeat;
color: #000;
font-size: 62.5%;
font-family: Helvetica,arial, verdana, sans-serif;
overflow:hidden;
background-position:center top;
width:100%;height:100%;
}
body#interviews{overflow:visible;background: #fff url(images/archiveback.jpg); background-repeat:repeat-x;background-position:top center;margin:0;padding:0;font-size: 62.5%;
font-family: Helvetica,arial, verdana, sans-serif;
}
body#interviews_single{overflow:inherit;background: #fff url(images/archiveback.jpg); background-repeat:repeat-x;background-position:top center;margin:0;padding:0;font-size: 62.5%;
font-family: Helvetica,arial, verdana, sans-serif;
}
PHP:
<?php if (in_category('interviews') || is_category('blog') || is_archive()) { ?>
<body id="interviews">
<?php } elseif (in_category('blog') ) { ?>
<body id="blog">
<?php } elseif (is_single() ||$post->post_parent == '4' ) { ?>
<body id="interviews_single">
<?php }else { ?>
<body class="home">
<?php } ?>
http://bicyclecatwalk.com/category/interviews
If you click on the thumbnails linked to the individual post you'll see the effect of two body ids at work? Becoming overly frustrated on this one. Would love some help
Cheers!
PHP conditional Body ID's Causing double scrollbar
Moderator: General Moderators
Re: PHP conditional Body ID's Causing double scrollbar
In the code you posted there's no way that both the <body id="interviews"> and the <body id="blog"> could be displaying at the same time. Something else must be wrong.
Re: PHP conditional Body ID's Causing double scrollbar
I believe its loading body id="interviews" twice since the only issue it is happening on is in a post that is both in_category('interview') and is_category('interview') seems to be placing two scrollbars on single interview posts.
Re: PHP conditional Body ID's Causing double scrollbar
Okay, so I see the problem you're talking about if I go to this link: http://bicyclecatwalk.com/interviews/20 ... h-guest-2/. Your post div is stretching your interview DIV and creating the double scroll bar. You'll need to make your post class scroll so it doesn't make your interview DIV run over. Try this:
[text]
body#interviews{overflow:visible;background: #fff url(images/archiveback.jpg); background-repeat:repeat-x;background-position:top center;margin:0;padding:0;font-size: 62.5%;
font-family: Helvetica,arial, verdana, sans-serif;
}
body.post {
max-height: 400px; overflow: scroll;
}
[/text]
Or you can just hide your overflow on your interview div like this:
[text]
body#interviews{max-height: 600px; overflow:hidden;background: #fff url(images/archiveback.jpg); background-repeat:repeat-x;background-position:top center;margin:0;padding:0;font-size: 62.5%;
font-family: Helvetica,arial, verdana, sans-serif;
}
[/text]
[text]
body#interviews{overflow:visible;background: #fff url(images/archiveback.jpg); background-repeat:repeat-x;background-position:top center;margin:0;padding:0;font-size: 62.5%;
font-family: Helvetica,arial, verdana, sans-serif;
}
body.post {
max-height: 400px; overflow: scroll;
}
[/text]
Or you can just hide your overflow on your interview div like this:
[text]
body#interviews{max-height: 600px; overflow:hidden;background: #fff url(images/archiveback.jpg); background-repeat:repeat-x;background-position:top center;margin:0;padding:0;font-size: 62.5%;
font-family: Helvetica,arial, verdana, sans-serif;
}
[/text]
Re: PHP conditional Body ID's Causing double scrollbar
Amazing. Thank you so---- much! Its amazing how a small css error after a ton of more complicated php cause a day long hangup. My sincere thank you's!!!!!!!
Matthew Welsh
Matthew Welsh