Forums

  • # February 12, 2013 at 5:39 pm

    Hi guys,

    I am not familiar with js or jquery but I need that to finish my “work”. I want to hide parent div bubble if value of, let say, custom_field (**CC_STAUS**) is empty.

    Below code is only a part of the rest:

    CC_STATUS

    and css

    .bubble {
    overflow:hidden;
    margin:5px 0 0 0;
    }
    .bubble .speach {
    background-color:#333333;
    color:#FFFFFF;
    padding:5px;
    margin:0;
    font-size: 12px;
    font-family: Segoe UI;
    text-transform: lowercase;
    }
    .bubble .arrow {
    margin:0 0 0 15px;
    width:0;
    height:0;
    border-left: 0px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #333333;
    border-top: 0;
    }

    To check the lenght of the **CC_STATUS** I have tried this code (which I simply adapted) but obviously it does not work. The bubble is always displaied no matter of it content.

    $(‘.bubble’).each(function() {
    if($(this).attr(‘CC_STATUS’) === ” || $(this).text() === ”) {
    $(this).parents(‘.bubble’).hide();
    }
    });

    See [jsfiddle](http://jsfiddle.net/9QayV/1/ “jsfiddle”)

    Thanks in advance for any (working) solution.

    # February 12, 2013 at 6:03 pm

    This? http://jsfiddle.net/9QayV/7/

    # February 12, 2013 at 6:13 pm

    No, it must be the same as my code, CC_STATUS is a tag that trigger value from external server.
    Your code is showing one bubble with text and another one below without text.
    I need to find something that will check walue of CC_STATUS tag and then hide div.bubble if this value is empty.

    # February 12, 2013 at 6:49 pm

    Why wouldn’t you just use PHP for this?

    # February 12, 2013 at 7:29 pm

    Hm… I’m creating template for instant messenger and **CC_STATUS** is used to get user description which I can display on contact list. So this tag, as many other like i.e. USER_NAME must be inserted in HTML code (not PHP) of the template.
    SO CC_STATUS is just constant element of the template. Is it possible that I could check with jquery that this tag has any value?

    # February 13, 2013 at 3:32 am

    nevermind

    # February 13, 2013 at 6:38 am

    IM (like Miranda or Trilian) is a program (so no live website) that is skinned almost the same way as HTML website. It is using IE engin to render themplate.
    To get some information about users we need to use some special tags – like CC_STATUS (for statuses), CC_NAME (for nicknames), CC_AVATAR (for avatars). There is a lot of other tags without template will not work. It looks probably the same as we creating website with PHP (in this case all information we take from database).
    Below is example of code displaing user table on contact list

    CC_USER_AVATAR

    CC_JID_PREFIX

    CC_STATUS

    including that part I am talkin about.

    I know that it is possible to write script that would check if CC_STATUS has any value – I mean if user in theyr messenger set any status (it can be just text, digit or url link or contain both).

    # February 13, 2013 at 7:20 pm

    Yes, I have… And te result is:

    http://i47.tinypic.com/2ppkfm8.jpg

    I would like to get this (but without empty bubble if CC_STATUS has no value)

    http://i46.tinypic.com/2uyrggh.jpg

    And your code could look like this http://codepen.io/MadaHo/pen/GHAIa

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag