[英]jQuery wrap breaks CSS pseudo elements
Alright so for a site I am working on I am creating these image piles. 好吧,对于我正在研究的网站,我正在创建这些图像堆。 I am trying to have so I can just grab an
<img>
then wrap it with the a div and have the css I set up take care of styling it to give it the image pile effect. 我试图这样,我可以抓住一个
<img>
然后用一个div包装它并让我设置的css照顾它的样式给它图像堆效果。
Here is a link to a fiddle . 这是一个小提琴的链接。 And here is the main part of the code.
这是代码的主要部分。
(function ($){
$.fn.ImagePile = function (options) {
var settings = $.extend({
pileType: "neat"
}, options);
//get pileType from settings
var pileType = settings.pileType;
switch(pileType){
case "neat":
return this.wrap("<div class='stack neat'></div>");
break;
}
};
})(jQuery);
$("#image1").ImagePile();
Forgot to mention that the problem is the :after
element is not showing up where it is supposed to be showing up. 忘记提到问题是
:after
元素没有出现在它应该出现的地方之后。
If you're not setting a left
or right
attribute for the absolutely positioned items, then it defaults to auto
which is fine for the :before
element but obviously not the :after
element. 如果你没有为绝对定位的项设置
left
或right
属性,那么它默认为auto
,这对于:before
元素很好,但显然不是:after
元素。
Just try setting a left
or right
attribute for the :before
and :after
in your CSS. 只需尝试为CSS中的
:before
和:after
设置left
或right
属性。
Fiddle: http://jsfiddle.net/39HKr/6/ 小提琴: http : //jsfiddle.net/39HKr/6/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.