jQuery的。点击()事件对CSS pseudoelement(:前/:之后)? [英] jQuery .click() event for CSS pseudoelement (:before/:after)?
问题描述
我要触发的时候,我通过CSS pseudoelements 插入内容的jQuery的动画:前:
和:在
点击。但是,我不知道如何做到这一点;我的第一个猜想, $(#ID:前)。点击()
没有工作。是jQuery的功能,这部分?如果是这样,我怎么会选择之前
/ 在
的内容?
I want to trigger a jQuery animation when content that I am inserting through the CSS pseudoelements :before:
and :after
is clicked. However, I'm not sure how to do this; my first guess, $(#id:before).click()
didn't work. Is this part of jQuery's functionality? If so, how would I select the before
/after
content?
推荐答案
jQuery的不支持CSS :之前
和:在
选择。 <击>选择的兄弟姐妹,使用 .siblings()
,然后从那里进行过滤。击>
jQuery does not support the CSS :before
and :after
selectors. To select siblings, use .siblings()
and then filter from there.
http://api.jquery.com/siblings/
这篇关于jQuery的。点击()事件对CSS pseudoelement(:前/:之后)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!