开发者

How to make style of an element dependent on another element's style

I need to set some special style for an element if some other element is visible (which is indicated by a special css class and can change dynamically). I need to do this because the page rendering and it's behavior is fully controlled by some framework's code and I don't want to change it. I can put any content anywher开发者_StackOverflowe in the body of the page. Is there a non-hacking way to do it?

My only idea was to use some plug-in like "watch" for jquery, but it's very ugly.


try using the properychange/attributemodified event

  $("object-in-question").bind("DOMAttrModified propertychange", function(e) {
    if($(this).is(":visible")).... etc
  });

http://jsbin.com/abece4

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜