Feed

jHover v1.0

by pazcal 26. October 2010 09:44

 

jHover image


I was working on my personal portfolio page for publishing a small piece of work I've done in my life. With this idea, I wanted a special way to navigate trough my Portfolio, but with larges images visible on my site. There are many ways to accomplish this with jQuery, or just to download a sweet plugin, but creating your own one is more fun (and also, I took me 4 weeks to think about what I really wanted, and no plugin didn’t matched my satisfaction).. So, I decided to create a special jQuery plugin for my Portfolio Page, called jHover.

   

What does it do?

jHover is a jQuery plugin which combines an image and a menu into 1 piece. Below, the Section 'What does it need', contains all the technical details and information you need to do and to implement, to get it all right. Basically, jHover will take inside the container, 1 image (a background-image) and a menulist and combines this together into 1 big thumbnail. When hovering the image, the menulist will slide in, right next to the image.

What does it need

The JS
The next piece of code, must be included in the <head>

    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="Scripts/jquery.easing.1.3.js" type="text/javascript"></script>
    <script src="Scripts/jquery.jHover.min.js" type="text/javascript"></script>

For activating the plugin:

    <script type="text/javascript">
        $(document).ready(function () {
            $(".jHover").jHover();
        });
    </script>

The HTML
The next code, must be included in the <body>

    <div id="ContactsContainer">
        <div class="jHover">
            <div id="Contacts" class="jHoverImage"></div>
            <ul class="jHoverMenu">
                <li><a href="YourUrl1">Text 1</a></li>
                <li><a href="YourUrl2">Text 2</a></li>
            </ul>
        </div>
    </div>

Note: The classes ‘jHoverImage’  and ‘jHoverMenu’ must be specified…

The CSS
The CSS below are the only CSS definitions, which are needed to get everything work (a.k.a. it looks like crap because it doesn’t have any styling-stuff). For a complete and finished version, check the example folder inside the .ZIP Download file.

    /* --- jHover --- */
    .jHover
    {
        float: left;
    }

    .jHover .jHoverImage
    {
        float: left;
        background-repeat: no-repeat;
        background-position: center center;
z-index: 5;
    }

    /* --- Image --- */
    .jHover #Contacts.jHoverImage
    {
        background-image: url(../Images/Contacts.jpg);
        width: 290px;
        height: 170px;
    }

    /* --- List --- */
    .jHover .jHoverMenu
    {
        float: left;
position: absolute;
    }


Done , or change the default parameters

If you included all the above information, the jHover should work properly. However, if you want to change some effects, speed or resize values, it’s possible:

    $(".jHover").jHover({
        "resizeValue": 25,                // Default: 50
        "menuPaddingValue": 0, // Default: 10
        "easingImage": "easeOutElastic", // Default: "easeOutElastic"
        "speedImage": 800, // Default: 1000
        "easingItems": "easeOutCirc", // Default: "easeOutCirc"
        "speedItems": 800 // Default: 1000
    });

Easing Types
For the easing technique, I’ve used the easing plugin from George Smith Graphic Design. If you want to change the easingType, I suggest you take a look at the jQuery Animate List or George Smith his site itself for what the possibilities are.

Furthermore

 

If you have any ideas, opinions, problems, suggestions, comments or other stuff, just let me know! I’m also trying to include even more options for this plugin, like:

  • Position menu where to slide and which direction
  • Submenu at menu
  • Ideas from others, perhaps?

Comments

10/27/2010 9:59:44 AM #

Very nice! Just what i needed!
Keep up the good work Smile

Michael | Reply

10/27/2010 11:08:46 AM #

Nice work Paz, keep doing what you do best

Anand | Reply

Add comment




biuquote
  • Comment
  • Preview
Loading



About the author

Hi. This picture next to this line is me, a.k.a. Pascal de Jonge. I'm currently working as a software engineer @ Tellus, Rotterdam, The Netherlands. Keywords for my work are .NET, C#, WPF, Silverlight, jQuery, CSS and some other random shizzle...

On my own free time, I'm running a small Webdesign/Development Company and playing a lot of games. Reason for this blog is for me to publish several projects like jQuery plugins, Silverlight Apps or WinPhone7 Apps...

Feel free to contact me or just to say 'hi' in several ways, like Twitter, the old fashion contactform or pascal[at]pazquality[.]com.

Widget Twitter not found.

Root element is missing.X

Mostly compatible with

Plugins compatibility

All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.