源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Jquery 高亮显示文本中重要的关键字

  • 时间:2020-05-18 12:01 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Jquery 高亮显示文本中重要的关键字
[h1]一、界面预览[/h1] [img]http://files.jb51.net/upload/2009-12/20091224015619167.gif[/img]   鼠标放到右边的Tab按钮上,文字透明度降低,同时一段文字高亮显示,效果如下: [img]http://files.jb51.net/upload/2009-12/20091224015619478.gif[/img]     Demo地址:[url=http://5thirtyone.com/sandbox/samples/fadefocus/]http://5thirtyone.com/sandbox/samples/fadefocus/[/url]   很绚丽的效果幺! [h1]二、实现原理[/h1]     将要高亮显示的文字加上<span>段落标记, class=”mask”的div 做为遮罩层,使此遮罩层位于文字内容之上(z-index属性,使用Jquery给段落动态添加样式类。 [b]三、HTML代码 [/b]
[url=#]<li><a class="d2" href="#">Avatar</a></li> <li><a class="d3" href="#">Formats</a></li> </ul> <div class="content"> <h2> Avatar (2009 film)</h2> <div class="entity-source"> <img src="images/avatar.jpg" alt="Avatar poster" /> <p> Avatar, also known as James Cameron's Avatar, is an American 3-D science fiction epic film written and directed by <a href="http://en.wikipedia.org/wiki/James_Cameron"> James Cameron</a>, and was released on December 16, 2009 by 20th Century Fox. The film is co-produced by <a href="http://en.wikipedia.org/wiki/Lightstorm_Entertainment"> Lightstorm Entertainment</a>, and <span class="d1">focuses on an epic conflict on Pandora</span>, an inhabited Earth-sized moon of Polyphemus, one of three fictional gas giants orbiting <a href="http://en.wikipedia.org/wiki/Alpha_Centauri_A">Alpha Centauri A</a>. On Pandora, human colonists and the sentient humanoid indigenous inhabitants of Pandora, the Na'vi, engage in a war over the planet's resources and the latter's continued existence. The film's title refers to <span class="d2">an avatar, a representation of a real person in a virtual world</span>.</p> <p> <span class="d3">The film was released in 2D and 3D formats</span>, along with an IMAX 3D release in selected theaters. The film is being touted as a breakthrough in terms of filmmaking technology, for its development of 3D viewing and stereoscopic filmmaking with cameras that were specially designed for the film's production.</p> <p> Read the rest of the <a href="http://en.wikipedia.org/wiki/Avatar_(2009_film)">original Wikipedia page about Avatar</a></p> <div class="mask"> </div> </div> </div> </div>
entity-results类中显示了Tab按钮,每个按钮控制左边文字的透明度,段落文字的高亮显示。 entity-source类中有三个段落span Calss分别为 d1 d2 d3,也就是高亮文字段落。 class=”mask”的空div放到最后,此Div也就是一个遮罩层。 四、CSS关键代码 类mask中的z-index:1 使得<div class=”mask”> 覆盖在左边文字内容之上。 z-nidex:2又使得span段落覆盖在<div class=”mask”>之上。从而显示实现了段落文字高亮显示。 五、Jquery代码
[url=http://demo.jb51.net/html/fadefocus/index.html]http://demo.jb51.net/html/fadefocus/index.html[/url] 打包下载地址: [url=http://xiazai.jb51.net/200912/yuanma/fadefocus.rar]http://xiazai.jb51.net/200912/yuanma/fadefocus.rar[/url]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部