Building the imgPreview Plugin
videos

Building the imgPreview jQuery Plugin

Today, we’ll be featuring the winner of our “Screencast Competition”. Created by James Padolsey, this video tutorial will demonstrate how to build a relatively advanced jQuery plugin from scratch.

A big congratulations goes out to James. He’ll be receiving $200 cash, a 1 year subscription to TUTS+, and $100 worth of credit at our Envato marketplaces.

Preview
  • Subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.


James Padolsey is JimmyP on Codecanyon
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://barttos.net/ Barttos

    Great xD

  • http://www.instantshift.com DKumar M.

    Nice one James…. I actually know a good alternative for same. Still good tutorial… thanks for sharing!!

  • http://blog.insicdesigns.com insic

    really awesome. Ive this this plugin working in James site. and now i fully understand how it works. good job no wonder this is the champion.

  • http://butai8.net Ben Carroll

    Wow I never realized how upside down jQuery is… I am glad I have stuck with mootools!

  • http://ramaboo.com/ David Singer

    jQuery rocks!

  • http://jeffhui.net/ Jeff Hui

    This is an awesome screencast. No one why it’s first :)

    MooTools emulates traditional OO system that most other languages implement. jQuery just follows javascript’s prototyping more closely.

  • http://yoosuf.awardspace.com/ M.A.Yoosuf

    its pretty awesome, its like the Theaiforests one, also like my recent blog post.

    i mean the same concept

    just have a cross check http://tinyurl.com/amg6bj

  • http://james.padolsey.com James

    Thanks for the comments! :)

    @Ben, I’m glad to have enlightened you; maybe you could enlighten us as to why you see jQuery as “upside down” … If anything MooTools is upside down, trying to make JavaScript into something it’s clearly not (a class based language). JavaScript’s strengths IMO are prototyping and the fact that it’s a functional programming language – jQuery plays to both of these strengths! In the end it’s down to programming technique and preferences. If you’re going to make a throw away comment like that on a jQuery hotbed (like Nettuts) then be prepared for a flaming! :D

    @M.A.Yoosuf, Nice work on that gallery! :)

  • Wuiqed

    James, this is wonderful. Big props for what I think is one of the best screencasts I’ve ever seen. I learned more about jQuery during these 30 minutes than I’ve learned about anything in such a short time! Concise but pedagogic, simple but advanced. Please, let me reiterate: wonderful!

    A question: which editor are you using?

  • http://blog.cfdesignz.co.uk Craig Farrall

    Awesome screencast James, an I must also add, a worthy winner. Congratulations :)

  • Frika

    Nice tutorial, thank you
    I have recognized that in IE7 is no fading image in the example with fading text and images. And the text (the a list) in the same example is looking very ugly, don´t know why.

  • http://www.chukki.de Chukki.de

    Very nice Screencast…it’s like the “Tips” in Mootools…only a little bit better :)
    I use it in our company for the presantation of a product if someone hovers the Name in the menu.

  • nolonx

    Thanks for the screencast James!

    I had already figured out much of this on my own, but still I learned a few things I didn’t know.

    And in any case I’m glad to see that the way I’m writing my plugins actually do make sense, so thank you for the confirmation! :)

  • Ethan

    Amazing! Thank you so much! Now I see why this won!

  • Pingback: Turulcsirip - Tamas Bogdan

  • http://www.freshclickmedia.com Shane

    Congratulations James – the screencast is great. I especially like the selector code.

    Go jQuery!

  • Ibrahim

    Congratulations James, awesome screencast :)

  • Cyril

    Amazing !!!

  • chris simpson

    amazing, as always. i love how customisable it is. Thanks James!

  • Tim Hall

    Wow… awesome tutorial James! I really enjoy learning these advanced jQuery skills. I don’t know how I would have figured out half of the stuff I know without these tutorials.

    My question is why do some lines end with a comma and others a semi-colon? For instance, the $container line (minus the line breaks) ends with a comma while the $img line ends with a semi-colon. They appear to be very similar so I was wondering what the distinction is.

    Thanks!

  • http://blog.brenelz.com Brenelz

    Great screencast James! Worthy winner forsure…

    Wish I was as much of a jQuery expert as you

  • http://www.twitter.com/anthonybruno Anthony James Bruno

    Pretty nice implementation of something similar here: http://www.tolleson.com/archive.php

  • Cossizle

    Judging from the comments this sounds great! I’ll have to take a look once I get a few things off my desk here at the office! Thanks!

  • http://james.padolsey.com James

    Thanks for the comments, I’m glad you all found it useful!! :)

    @Tim, the comma can be used when declaring several variables, so instead of:

    var a = 1; var b = 2; var c = 3;

    You could do:

    var a = 1, b = 2, c = 3;

    @Wuiqed, Komodo Edit.

  • http://www.jackfranklin.co.uk Jack F

    Bow down! Awesome tutorial worthy winner! A couple of questions from me if you don’t mind:

    1. This line:

    $container = $(”);
    Cofnused me. So here are you creating a variable called container of which the contents are a new div which also has a inside?

    Although I never knew that using ” makes jQuery create the closing tag as well :D

    2. What editor are you using there?

    Thanks!

  • http://www.jashsayani.com Jash Sayani

    jQuery is the future !

  • http://www.tjkoblentz.com TJ

    Well done James, love your stuff!

  • http://mdnet.imeem.com MD

    Great tutorial!! Thanks :)
    Hey… your firefox looks like chrome! how did u do that?

  • http://www.leomiranda.com.br Leonardo

    I Love JQuery !!!

    Great Plugin

  • Rik Girbes

    dude amazing!! Ty

    Rik

  • http://valendesigns.com Derek

    Always good stuff from you. Keep them coming.

  • http://www.tuckr.com.ar Bernardo

    Great Tutorial

  • http://www.mykoala.com Andres F

    James, thanks for a great screencast! I plan on watching it at least a few more times to make sure I fully grasp everything you mentioned. Very well done, and congrats again. I hope to see yet even more jQuery stuff in the near future.

  • Hayden

    Great tutorial! However, I was wondering if there is a way to make the image go above the cursor if there isn’t enough screen space below it (similar to ThemeForest). Thanks!

  • Bill

    God damn this is awesome, although it f***ed with my mind heh ^^

  • MSB

    fabulous..
    10/10.. :)

  • http://www.hotcouponz.com hotcouponz

    Great tutorial as always. Thank you

  • http://spotmeon.blogspot.com Gaurav M

    Great
    jQuery always in rocking Mood

  • http://chrisgunther.net Chris Gunther

    Awesome tutorial. Job well done. Looking forward to more like this.

  • http://www.pillaidesign.com Pillai Design

    Wow, endless possibilities with this trick!

  • http://jasonseney.com Jason

    Fantastic tutorial, really like how you described each part of building a proper and expandable plugin. I’m glad your video is here, and hope it will help teach the importance of quality plugins that developers can then share across the community.

    Thanks!

  • http://www.thefloatingfrog.co.uk Frog

    Neat little tool

  • Roy del Rosario

    Hey Jeff, or anybody who’s managing this fantastic site ;) … i think the Source code is not linked properly.. (it’s linked to the Demo page)

  • Pingback: Weekly links! | Shaun Preston

  • Pingback: Muazzam Jquery Çalışmaları ! - Miraç Baran Satıç’ın Günlük Blogu

  • http://www.blogbisnisinternet.com bisnis internet

    Your create very useful plugin, thanks

  • Pingback: 55 Decisive Useful jQuery Tutorials « my mcLife

  • http://rekomendasibisnisinternet.com rekomendasi bisnis internet

    Still good tutorial… thanks for sharing!

  • Pingback: 55 Decisive Useful jQuery Tutorials « i-render | Creative Media

  • http://www.rockinghamgateway.com/ Karl

    hi mate, finely worked it out, got on problem thou

    I added to a table, I’m un able to line up my table to center, is there a way to center the table via CSS ?

    Karl