DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> jQuery入門知識 >> JQuery特效代碼 >> jQuery插件jFade實現鼠標經過的圖片高亮其它變暗
jQuery插件jFade實現鼠標經過的圖片高亮其它變暗
編輯:JQuery特效代碼     

今天為大家帶來一款鼠標經過當前高亮其它變暗jQuery插件jFade,此款插件能實現的功能簡單而且很實用,當鼠標經過圖片列表或是文字列表時懸停當前高亮顯示,其它圖片列表變暗突出顯示鼠標當前懸停。

代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta name="Author" content="pakaerf"> 
    <script type='text/javascript' src='jquery.min.js'></script>
    <script type='text/javascript' src='jfade.js'></script>
    <link rel="stylesheet" href="main.css"  type="text/css"/>
    <script type="text/javascript"> 
    $().ready(function() {
        $('.jfade_image').jfade();
        $('.portfolio').jfade({
            start_opacity: ".4",
            high_opacity: "1",
            low_opacity: ".2",
            timing: "500"
        });
        $('.button').jfade({
            start_opacity: "1",
            high_opacity: "1",
            low_opacity: ".4",
            timing: "500"
        });
        $('.text').jfade({
            start_opacity: "1",
            high_opacity: "1",
            low_opacity: ".7",
            timing: "500"
        });
        $('.links').jfade({
            start_opacity: ".9",
            high_opacity: "1",
            low_opacity: ".2",
            timing: "500"
        });
    }); 
    </script> 
</head>
<body>
    <div id="wrapper">
        <h1>jFade</h1>
        <p>jFade is a simple jquery plug-in that lets you highlight items on your website. Not only are customizable fades possible, but easy control of surrounding elements makes your most important content stand out.</p><br />
        <h2>Portfolio Gallery</h2><br />
        <p>(Fade adjoining objects out)</p>
        <div id="images">
            <img src="images/card02.jpg" class="jfade_image"/>
            <img src="images/card04.jpg" class="jfade_image"/>
            <img src="images/card09.jpg" class="jfade_image"/>
            <img src="images/card13.jpg" class="jfade_image"/>
            <img src="images/card14.jpg" class="jfade_image"/>
            <img src="images/card15.jpg" class="jfade_image"/>
            <img src="images/card16.jpg" class="jfade_image"/>
            <img src="images/card17.jpg" class="jfade_image"/>
        </div><br /><br />
        <p>To use default settings just add the function </p>
        <code><script type="text/javascript">  <br />
    $().ready(function() {<br />
        $('.jfade_image').jfade();<br />
    });  <br />
</script></code><br /><br />
        <p>and add the class tag to each element:</p>
        <code><img src="images/card02.jpg" class="jfade_image"/><br />
            <img src="images/card04.jpg" class="jfade_image"/><br />
            <img src="images/card09.jpg" class="jfade_image"/><br />
            <img src="images/card13.jpg" class="jfade_image"/><br />
            <img src="images/card14.jpg" class="jfade_image"/><br />
            <img src="images/card15.jpg" class="jfade_image"/><br />
            <img src="images/card16.jpg" class="jfade_image"/><br />
            <img src="images/card17.jpg" class="jfade_image"/></code><br /><br />
        <p>Custom settings are easily set and explained in the help doc</p><br /><br />
        <h2>Portfolio Gallery 2</h2><br />
        <p>(Fade objects in)</p>
        <div id="images">
            <img src="images/card02.jpg" class="portfolio"/>
            <img src="images/card04.jpg" class="portfolio"/>
            <img src="images/card09.jpg" class="portfolio"/>
            <img src="images/card13.jpg" class="portfolio"/>
            <img src="images/card14.jpg" class="portfolio"/>
            <img src="images/card15.jpg" class="portfolio"/>
            <img src="images/card16.jpg" class="portfolio"/>
            <img src="images/card17.jpg" class="portfolio"/>
        </div><br /><br />
        <h2>Call to Action Button</h2><br />
        <p>(give buttons some flair)</p>
        <div id="buttons">
            <ul>
                <li>
                <a class="small button green" href="http://www.cnblogs.com/" target="_blank" >Green </a>
                <a class="small button blue" href="http://www.cnblogs.com/" target="_blank" >Blue </a>
                <a class="large button pink" href="http://www.cnblogs.com/" target="_blank" >Pink </a>
                <a class="small button orange" href="http://www.cnblogs.com/" target="_blank" >Orange </a>
                <a class="small button yellow" href="http://www.cnblogs.com/" target="_blank" >Yellow </a></li>
            </ul>
        </div><br /><br />
        <h2>Text</h2><br />
        <p>(have subtle effects)
        <div id="paragraphs">
            <div id="column" class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus in eleifend justo. Aenean a porttitor enim. Sed aliquet ullamcorper euismod. Morbi dapibus pretium mauris. Pellentesque consequat ante et magna gravida eleifend. Donec et lorem nulla. Integer dignissim nisi et lectus bibendum ornare venenatis odio venenatis. Aliquam dignissim iaculis neque, sed accumsan erat aliquam porttitor.</div>
            <div id="column" class="text">Quisque lobortis, turpis id ornare mollis, diam magna semper libero, lacinia pharetra lectus nibh eget purus. Aenean dignissim sollicitudin gravida. Suspendisse non leo at nunc tempus elementum. Curabitur vitae commodo libero. Sed erat tortor, ornare id luctus vel, ullamcorper eget lacus. Maecenas ac placerat lectus. Sed quis nunc vitae lacus dignissim interdum. </div>
            <div id="column" class="text">Nulla facilisi. In et ante tellus, quis feugiat ante. Sed et lectus id ante viverra fringilla in eget nisi. Duis sit amet augue lorem, quis luctus erat. Morbi sed diam id orci lacinia tincidunt vel auctor velit. Etiam pulvinar nibh eget ante tincidunt rhoncus. Morbi commodo eros lobortis dolor suscipit eleifend. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </div>
        </div><br /><br /><br /><br />
        <div id="footer">
            <h2>Links</h2><br />
            <p>You can fade anything you like, by just adding a class - even links: <a href="http://www.cnblogs.com/" title="Facebook" target="_blank" class="links">facebook</a>, <a href="http://www.cnblogs.com/" target="_blank" title="Linkedin" class="links">linkedin</a>, <a href="http://www.cnblogs.com/" title="Flavors.me Personal Page" target="_blank" class="links">flavors.me</a></p> <br /><br />
        </div>
    </div>
</body>
</html>

以上就是本文的全部內容了,希望對大家熟練掌握jQuery特效能有所幫助。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved