ImgCenter | How To Use It

Obviously you need to make sure you have the latest jQuery library already loaded in your page. After that it's really simple, just add the following code to your page:

$(function(){
    $("img").imgCenter();
});

If you want this thing to work best cross-browser, make sure you put that code into the window.load event. Like this:

$(window).load(function(){
    $("img").imgCenter(); 
});

Make sure your selector points to an actual image. If you wanted to center only a select group of images on your page, rather than all the images on your page, just do this:

$(window).load(function(){
    $("#someElement div.someClass img").imgCenter(); 
});

You will need to make sure you have a width and height set on your parent element that contains the image, so it has values to do the re-sizing against.

Here is how to implement the plugin with some options:

$(window).load(function(){
    $("#someElement div.someClass img").imgCenter({ 
        parentSteps: 3, 
        end: function(){
            alert("All Done!");
        }
    }); 
});

Recent Discussions

08 Feb, 2017 08:05 AM
08 Feb, 2017 08:02 AM
08 Feb, 2017 07:56 AM
08 Feb, 2017 07:53 AM
08 Feb, 2017 07:45 AM