I am fighting this thing and cannot figure it out... can someone please help.
I want to find the last DIV in the BODY that: A) Is NOT a specified ID (the easy part); and B) Does NOT have fixed positioning (the part that's killing me)
Basically, I am looking for the last DIV in the BODY that's part of the flow, so I can add a bit of margin-bottom.
this is where I am at so far:
$(theBody).children('div').not('#toolbar').not(':fixed').find(':last');
$.expr[':'].fixed = functio开发者_JAVA百科n(obj, index, meta, stack){
if ($(obj).css('position')=='fixed') {
return true;
} else {
return false;
}
};
it's not working, and I think the custom selector is overthinking it.... I just dunno how to work it in there.
Thanks in advance, folks!
First thing you need to do is define the custom selector above the code where you use it :)
The selector I believe you want is...
$('body > div:fixed:not(#toolbar):last')
jsFiddle.
I also provided a terser custom selector...
$.expr[':'].fixed = function(obj){
return $(obj).css('position') == 'fixed';
};
精彩评论