Metaobjects 介绍
The Metadata plugin on steroids , Now at version 1.3 (released on
2007-03-02)
Metaobjects is used for setting properties of DOM elements, from something as
simple as a boolean to something as complex as a function declaration or
executable code, too.
In the following example we set the title property of the span to the title of
the web page without a single line of javascript ( pretty useless, but awesome
;-)
BEFORE
<span><object class="Metaobject"> <param name="title" value="document.title"/> </object>Hover your mouse here to see the title of this page</span>
AFTER
<span>Hover your mouse here to see the title of this page</span>
As you see the Metaobject is automatically removed. And abracadabra… if you
does as it says (hover) you’ll really see the tooltip with the title of the
page, even if there is not an HTML explicit “title” property.
You can also use the added Metadata from jQuery, like here:
BEFORE
<span id="foo"><object class="Metaobject"> <param name="bar" value="Hello World!"/> </object>I'm going to say... </span>
USING jQuery
$( "#foo" ).append( $( "#foo" )[0].bar );
AFTER
<span id="foo">I'm going to say... Hello World!</span>
Metaobjects 官网
http://plugins.jquery.com/project/metaobjects
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。