我有一个图像按钮样式:
.sticky {
position: fixed;
top: 50px;
width: 120%;
z-index: 1;
}
@media screen and (min-device-width : 100px) and (max-width: 600px) {
.sticky{
display:none;
}
}
和脚本:
window.onscroll = function() {
myFunction();
}
var backarrow = document.getElementById("back");
var sticky = backarrow.offsetTop;
function myFunction() {
if (window.pageYOffset >= sticky) {
backarrow.classList.add("sticky");
} else {
backarrow.classList.remove("sticky");
}
}
它确实有效!但我不明白为什么FireFox禁用Clicking,而其他浏览器没有问题。 z-index设置为1,但其他浏览器可以正常使用但是FF。我能做些什么以及如何解决它?非常感谢谁知道!
我刚刚为图像按钮链接做了这个:
<a href="#top" <a href="#wrap"
适用于任何浏览器。这甚至不是一个脚本。但我可能不够好css。
'>
<img alt="" class="mainlogo" src='data:image/png;base64,<?php echo base64_encode(file_get_contents("******.png")); ?> '>
<button class="right"> <a href="#wrap" class="next" onclick="plusSlides(1)"> <img alt="" id="forward" class="logo" style='max-width: 40px;' src='data:image/png;base64,<?php echo base64_encode(file_get_contents("*****/Pictur3.png")); ?> '> </a> </button>
我做的是我放
<button onClick="location.href = '#wrap'"
对于按钮元素,但为
<a href
它不起作用所以我正在寻找解决方案它将如何工作
<a href="#top"
以来
对FireFox没有帮助
我解决了问题!!!!!!!!!!我所做的是使用我的按钮id作为我的jquery脚本而不是img id。因此,整个按钮将向下滚动而不是仅向图像滚动,因此我可以实现
<button onClick="location.href = '#top'"
而不是任何我尝试过但不起作用的<img onclick
或<href onclick
事件。希望它也可以帮助任何人作为例子:)