第n个子选择器不适用于Tingle.js';属于移动电话上JavaScript的类 HTML中不存在类tingle-modal\uu\u close,因为它属于JavaScript。当您单击超链接锚点打开模式时,JavaScript将添加此类 Tinge CSS文件中存在类Tinge-modal\uu\u closedo。但是第n个子项选择器不适用于该类,因为该类属于JavaScript。下面是一个小例子:
这意味着第一个窗口关闭按钮是橙色的,第二个是紫色的 通过单击/启用/打开模式,JavaScript添加了编译后的HTML,以及第n个子选择器不适用于Tingle.js';属于移动电话上JavaScript的类 HTML中不存在类tingle-modal\uu\u close,因为它属于JavaScript。当您单击超链接锚点打开模式时,JavaScript将添加此类 Tinge CSS文件中存在类Tinge-modal\uu\u closedo。但是第n个子项选择器不适用于该类,因为该类属于JavaScript。下面是一个小例子:,javascript,html,css,css-selectors,Javascript,Html,Css,Css Selectors,这意味着第一个窗口关闭按钮是橙色的,第二个是紫色的 通过单击/启用/打开模式,JavaScript添加了编译后的HTML,以及tingle-modal\uuu\uu close: <div class="tingle-modal tingle-modal--visible" style=""> <button type="button" class="tingle-modal__close"> <span class="tingle-modal__clo
tingle-modal\uuu\uu close
:
<div class="tingle-modal tingle-modal--visible" style="">
<button type="button" class="tingle-modal__close">
<span class="tingle-modal__closeIcon">
<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
<path d="M.3 9.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3L5 6.4l3.3 3.3c.2.2.5.3.7.3.2 0 .5-.1.7-.3.4-.4.4-1 0-1.4L6.4 5l3.3-3.3c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L5 3.6 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4L3.6 5 .3 8.3c-.4.4-.4 1 0 1.4z" fill="#000" fill-rule="nonzero"></path>
</svg>
</span>
<span class="tingle-modal__closeLabel">Close</span>
</button>
<div class="tingle-modal-box">
<div class="tingle-modal-box__content">
<h1>Section 1</h1>
<blockquote>“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”</blockquote>
<cite>Marilyn Monroe</cite>
</div>
</div>
</div>
接近
第一节
“我自私,不耐烦,有点不安全。我犯错误,我失控,有时很难对付。但如果你不能在我最坏的时候对付我,那么你肯定配不上我最好的时候。”
玛丽莲·梦露
您可以使用JSFIDLE进行测试,并请将预览窗口的大小调整为小于530px:
:第n个孩子,顾名思义,是其父代的第n个孩子。打开模式时,“关闭”按钮始终是模式的第一个子项。使用类似于.tingle-modal:nth-child(1).tingle-modal\u\u close
的方法会更合适,如果modals总是按正确的顺序()
但是,如果要将类添加到模型中,库允许您提供一个cssClass
选项。您可以使用它来做您想做的事情:
JS
CSS
:第n个子项
,顾名思义,是其父项的第n个子项。打开模式时,“关闭”按钮始终是模式的第一个子项。使用类似于.tingle modal:nth child(1).tingle-modal\uu close
的方法会更合适,如果modals总是以正确的顺序()@blex,有解决方案吗?这似乎与Robin的CSS或JavaScript问题有关。
<div class="tingle-modal tingle-modal--visible" style="">
<button type="button" class="tingle-modal__close">
<span class="tingle-modal__closeIcon">
<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
<path d="M.3 9.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3L5 6.4l3.3 3.3c.2.2.5.3.7.3.2 0 .5-.1.7-.3.4-.4.4-1 0-1.4L6.4 5l3.3-3.3c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L5 3.6 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4L3.6 5 .3 8.3c-.4.4-.4 1 0 1.4z" fill="#000" fill-rule="nonzero"></path>
</svg>
</span>
<span class="tingle-modal__closeLabel">Close</span>
</button>
<div class="tingle-modal-box">
<div class="tingle-modal-box__content">
<h1>Section 1</h1>
<blockquote>“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”</blockquote>
<cite>Marilyn Monroe</cite>
</div>
</div>
</div>
var modalTinyNoFooter = new tingle.modal({
cssClass: ['modal-1'],
// ...
});
// ...
var modalTinyNoFooter2 = new tingle.modal({
cssClass: ['modal-2'],
// ...
});
// ...
var modalTinyNoFooter3 = new tingle.modal({
cssClass: ['modal-3'],
// ...
});
// ...
.tingle-modal.modal-1 .tingle-modal__close {
background-color: var(--orange-600) !important;
}
.tingle-modal.modal-2 .tingle-modal__close {
background-color: var(--purple-600) !important;
}