gpt4 book ai didi

javascript - 页面和帖子上的 Wordpress 侧边栏定位

转载 作者:行者123 更新时间:2023-11-28 01:30:23 32 4
gpt4 key购买 nike

几个小时以来,我一直在尝试解决我在本地托管的 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 的 right 属性之间的差异是 75px,我找不到理由。

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

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

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

会为了一个解决方案而嫁给某人......

亲切的问候

最佳答案

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

就这么简单:

#content{
width: 80%;
}

关于javascript - 页面和帖子上的 Wordpress 侧边栏定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51013271/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com