Javascript 在after content+;上解析属性时出现意外的NaN值;z指数
我有一个非常奇怪的问题,这里是: 我想创建一个像这个主题一样的透视阴影(::在我的例子中是after) 然后当我加载我的网页,然后我点击firefox中的“inspect element”并点击代码中的某些内容时,我得到了这个问题“解析属性时意外的NaN值”,我在论坛上搜索,人们说这可能是Qjery问题,但当我删除这个::一切正常后。 这是我的Javascript文件:Javascript 在after content+;上解析属性时出现意外的NaN值;z指数,javascript,html,css,position,z-index,Javascript,Html,Css,Position,Z Index,我有一个非常奇怪的问题,这里是: 我想创建一个像这个主题一样的透视阴影(::在我的例子中是after) 然后当我加载我的网页,然后我点击firefox中的“inspect element”并点击代码中的某些内容时,我得到了这个问题“解析属性时意外的NaN值”,我在论坛上搜索,人们说这可能是Qjery问题,但当我删除这个::一切正常后。 这是我的Javascript文件: function styleTabHover(tabButton){ tabButton.style.color= "
function styleTabHover(tabButton){
tabButton.style.color= "#ff9900";
}
function styleTabOut(tabButton){
tabButton.style.color= "white";
tabButton.style.borderColor= "white";
}
function check_email(ev){
var champ = ev.currentTarget;
if(!champ.value.includes("@")){
champ.style.outline = "2px dotted red";
document.getElementById("champ_requis").style.opacity = "1";
}else{
champ.style.outline = "none";
document.getElementById("champ_requis").style.opacity = "0";
}
}
function changeTab(idbouton){
var tabs = document.getElementsByClassName("menu_bouton");
console.log(tabs,"changetab fonction lancé")
var i;
for (i=0;i<tabs.length;i++){
tabs[i].style.backgroundColor = "initial";
tabs[i].style.zIndex = "0";
tabs[i].onmouseover = function(){styleTabHover(this)};
tabs[i].onmouseout = function(){styleTabOut(this)};
}
var bouton = document.getElementById(idbouton);
bouton.style.background = "#ff9900";
bouton.style.color = "white";
bouton.onmouseover= function(){this.style.cursor = "default"};
}
var imgPositionMoins = 0;
function style_projet_slide(droite){
var lst_projetImg = document.getElementsByClassName("projets_img");
var i;
if(droite && (imgPositionMoins > (-100*(lst_projetImg.length-1)) ) ){
imgPositionMoins -= 100;
for(i=0;i<lst_projetImg.length;i++){
lst_projetImg[i].style.left = imgPositionMoins+"%";
}
}else if ( !droite && imgPositionMoins < 0){
imgPositionMoins += 100;
for(i=lst_projetImg.length-1; i>=0; i--){
lst_projetImg[i].style.left = imgPositionMoins+"%";
}
}
}
function projet_desc(indice){
var lst_desc=document.getElementById("projet_desc").children;
var i;
for (i=0;i<lst_desc.length;i++){
if (i==indice){
lst_desc[i].style.display = "block";
} else{
lst_desc[i].style.display = "none";
}
}
window.scroll({
top: 800,
left: 0,
behavior: 'smooth'
});
}
函数样式tabhover(tabButton){
tabButton.style.color=“#ff9900”;
}
函数样式选项卡(选项卡按钮){
tabButton.style.color=“白色”;
tabButton.style.borderColor=“白色”;
}
功能检查电子邮件(ev){
var champ=ev.currentTarget;
如果(!champ.value.includes(“@”)){
champ.style.outline=“2px点红色”;
document.getElementById(“champ_requires”).style.opacity=“1”;
}否则{
champ.style.outline=“无”;
document.getElementById(“champ_requires”).style.opacity=“0”;
}
}
函数更改选项卡(idbouton){
var tabs=document.getElementsByClassName(“菜单”);
console.log(选项卡,“changetab fonction lancé”)
var i;
对于(i=0;i(-100*(第一个项目长度-1))){
imgPositionMoins-=100;
对于(i=0;i=0;i--){
lst_projetImg[i].style.left=imgPositionMoins+“%”;
}
}
}
功能项目描述(指示){
var lst_desc=document.getElementById(“projet_desc”).children;
var i;
对于(i=0;当我们可以复制错误时,你能发布一些小提琴或代码笔的例子吗?以及FF、win、mac v的哪个版本?有几个页面,我不知道问题来自何处,我将编辑以放置我的JS文件,希望它能帮到你,并且我在windows上。
function styleTabHover(tabButton){
tabButton.style.color= "#ff9900";
}
function styleTabOut(tabButton){
tabButton.style.color= "white";
tabButton.style.borderColor= "white";
}
function check_email(ev){
var champ = ev.currentTarget;
if(!champ.value.includes("@")){
champ.style.outline = "2px dotted red";
document.getElementById("champ_requis").style.opacity = "1";
}else{
champ.style.outline = "none";
document.getElementById("champ_requis").style.opacity = "0";
}
}
function changeTab(idbouton){
var tabs = document.getElementsByClassName("menu_bouton");
console.log(tabs,"changetab fonction lancé")
var i;
for (i=0;i<tabs.length;i++){
tabs[i].style.backgroundColor = "initial";
tabs[i].style.zIndex = "0";
tabs[i].onmouseover = function(){styleTabHover(this)};
tabs[i].onmouseout = function(){styleTabOut(this)};
}
var bouton = document.getElementById(idbouton);
bouton.style.background = "#ff9900";
bouton.style.color = "white";
bouton.onmouseover= function(){this.style.cursor = "default"};
}
var imgPositionMoins = 0;
function style_projet_slide(droite){
var lst_projetImg = document.getElementsByClassName("projets_img");
var i;
if(droite && (imgPositionMoins > (-100*(lst_projetImg.length-1)) ) ){
imgPositionMoins -= 100;
for(i=0;i<lst_projetImg.length;i++){
lst_projetImg[i].style.left = imgPositionMoins+"%";
}
}else if ( !droite && imgPositionMoins < 0){
imgPositionMoins += 100;
for(i=lst_projetImg.length-1; i>=0; i--){
lst_projetImg[i].style.left = imgPositionMoins+"%";
}
}
}
function projet_desc(indice){
var lst_desc=document.getElementById("projet_desc").children;
var i;
for (i=0;i<lst_desc.length;i++){
if (i==indice){
lst_desc[i].style.display = "block";
} else{
lst_desc[i].style.display = "none";
}
}
window.scroll({
top: 800,
left: 0,
behavior: 'smooth'
});
}