css - jQuery select if no predecessor matches class -
in sharepoint portal trying fix problem lists wider page borders (custom master page) , funny when display on far right. writing jquery function reset width.
my function works fine, fine works in sharepoint dialogues, - don't want work in dialogues!
here method of selecting elements, works.
var elements = $(".s4-wpcell-plain > div > *, #pagebody.s4-ca > div > *");
however, want exclude matching if page run in dialogue. now, there .ms-dlgcontent
style, way above (like, parent of parent of parent, etc...) of elements i'm using in selector match.
how can match element if there no predecessor matches class?
[update]
well, thank you, faithful jquery gurus such quick responses. tried of techniques , doesn't quite trick, let me explain bit more (sorry didn't think of before).
here css path #pagebody
div in dialogue. can see class specifying dialog @ start.
html.ms-dialog body form#aspnetform div#s4-workspace.s4-nosetwidth div#s4-bodycontainer div#ctl00_mso_contentdiv div#pagebody.s4-ca
this css path of #pagebody
element regular page.
html body form#aspnetform div#s4-workspace.s4-nosetwidth div#s4-bodycontainer div#ctl00_mso_contentdiv div#pagebody.s4-ca
so, need affect #pagebody
main page , not dialogue. keep in mind want avoid selecting based on sharepoint-generated guids.
[edit]
uh, sorry, after looking @ paths, realize have use ms-dialog
instead ot ms-dlgcontent
. i'll mark answer now.
try this:
var elements = $(".s4-wpcell-plain > div > *, #pagebody.s4-ca > div > *"); var elementsnotindialoge = elements.filter(function() { return !$(this).parents('.ms-dlgcontent').length; });
Comments
Post a Comment