I am having a page with the following as its :
HTML
<div class="parent">
    <div class="fbNubFlyoutOuter">
        <div class="fbNubFlyoutInner">
            <div class="predecessor"></div>
            <div class="fbNubFlyoutFooter">
                <div class="_552h hidden_elem"></div>
                <div class="other"></div>
            </div>
            <div class="successor"></div>
        </div>
    </div>
    <div class="boxMargin"></div>
    <div class="rest"></div>
</div>
Now, the following things happen (all happens dynamically, so only single if-else won't do):
The
divwith class_552hgets shown/hidden by adding/removing classhidden_elemto it respectively.Now, I am trying to change the CSS for
boxMarginasbackground-color:red;whenever there is classhidden_elemadded to_552h. Otherwise,boxMarginhasbackground-color:green;.
CSS is like:
._552h {
    background-color:yellow;
    border:1px solid black;
    height:50px;
    width:50px;
}
._552h.hidden_elem {
    display:none;
}
.boxMargin {
    height: 50px;
    width: 50px;
    border:1px solid black;
    background-color:green; /*should be become red when _552 is hidden*/
}
/*Maybe add a .boxMargin hidden class rule, where bkg color is red*/
Note: I will not be able to create custom events because, it will require me to trigger them which is not possible for me here since show/hide happens by some other scripts which I cannot edit. Also, I do not intend to use attrchange plugin for jQuery.
This can be solved by binding show/hide events for _552h somehow. 
I have looked through some solutions to this on SO, but most of them involve creating custom hide/show event and triggering them, which is not possible as I have mentioned.
Also, I saw this : https://stackoverflow.com/a/19525797/3751213. But it is not fired, I don't know why.
Can there be simple CSS solution to this?(by parent or sibling selection maybe)
Or, I will have to go with either attrchange or DOMListeners(for attributes) or custom events anyhow? If so how will I get it?
The link which I mentioned, I have tried here: JSFIDDLE
Since, the situation might be confusing, question will be editted to provide all information needed.
EDIT
It will also be fine if I can make the fiddle work.