【问题标题】:Wordpress sidebar positioning on page and postWordpress 侧边栏在页面和帖子上的定位
【发布时间】:2018-06-25 16:43:54
【问题描述】:

几个小时以来,我一直在尝试解决我在本地托管的 wordpress 网站上使用标准侧边栏时遇到的问题。

我的侧边栏代码如下: 定制器中的 CSS:

function mySlide(){
var x = document.getElementById("sidebar");
var y = document.getElementById("slider");
if(x.style.right === "0px"){
	x.style.right = "-305px";	
	y.src = "arrow_left.png";
}else{
	x.style.right = "0px";
	y.src= "arrow_right.png";
	}
}
#sidebar{	
	background-color: #571e0b;
	padding: 0px 0px 0px 20px;
	position: fixed;
	top: 50px;
	right: -305px;
	height: 100%;
	width: 300px;
	transition: 0.5s;
	-webkit-transform: 0.5s;
	z-index: 2;
}
#slider {
	padding: 10px;;
	height: 50px;
	position: relative;
	left: -65px;	
	background-color: #571e0b;
	border-radius: 0px 0px 0px 15px;
}
<div id="sidebar">
  <input alt="slider_button" id="slider" type="image" onclick="mySlide()" src="arrow_left.png">
</div>

这种侧边栏位于帖子和页面上。但是,页面和帖子上#sidebar的正确属性之间的差异是75px,我找不到理由。

到目前为止,我能找到的唯一线索是,这与页面是全角的而博客不是全角有关。

我的网站的其他特点: 主题:Themify Ultra v1.99 插件:Contact Form 7、Themify Portfolio Post、WP Super Cache

到目前为止我尝试了什么: 删除受影响页面上的所有内容。 重新安装主题和插件

会为了解决问题嫁给某人...

亲切的问候

【问题讨论】:

  • 这里没有足够的信息来帮助你。
  • 你能告诉我你需要什么额外的信息吗?

标签: javascript php css wordpress sidebar


【解决方案1】:

我找到的解决方案是使用 CSS 的解决方法。我将所有页面设置为非全宽,然后我使用 CSS 告诉容器调整大小。

很简单:

#content{
  width: 80%;    
}

【讨论】:

    猜你喜欢
    • 2016-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-11
    • 2012-07-24
    相关资源
    最近更新 更多