SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Combing jQuery "not" and "css" with css attribute value

    jQuery novice to intermediate here. I have an equal heights script working but I only want to apply it to DIVs that have a CSS attribute/value pair of "float: left" and not to DIVs with a CSS attribute/value pair of "float: none." What I have so far is:

    Code:
    $('.blog #content, .blog #sidebar').not('.blog #content, .blog #sidebar').css({ float: "none" }).equalHeights();
    (It may not matter but this is part of an attempt to get my site to work in iPad portrait mode where it is going to be the only case where the content DIV and the sidebar DIV are not floated next to each other and in which case I will not need the columns to be of equal height.)

    The code I have now is doing something, and it's not necessarily breaking anything. It seems to work correctly in iPad portrait mode but then undoes the equal heights in iPad landscape and display devices with larger viewports. Is this because jQuery is unable to query CSS attribute values and can only set them?

  2. #2
    SitePoint Addict MrBaseball34's Avatar
    Join Date
    Sep 2002
    Location
    Round Rock, Texas
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    look at the parentheses, I think this will work:
    Code:
    $('.blog #content, .blog #sidebar').not($('.blog #content, .blog #sidebar').css({ float: "none" })).equalHeights();
    MrBaseball34
    Hook'Em Horns!

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. Will check that out. Yes, sometimes it gets hard keeping track of all the different brackets, parentheses, etc.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •