Insane image centerie thing

by karim79

JavaScript

// horizontally and vertically center an image

/*
var centerImage = function ($img, kill) {
    var newMarginTop = (($flexSlider.height() / 2) - ($img.height() / 2)),
        newMarginLeft = (($flexSlider.width() / 2) - ($img.width() / 2));
    $img.css({
        marginLeft: newMarginLeft + "px",
        marginTop: newMarginTop + "px"
        //avoidTransforms: true
    });
};
*/


/*
var $slideImg = null;
$("#imageView ul.slides li.slide img").each(function () {

    var src = $(this).data("src");
    $(this).on("load", function () {

        $slideImg = $(this);

        setTimeout(function () {
            //centerImage($slideImg, true);
        }, 300);

    }).attr("src", src);
});
*/

/*
var resizeHandler = function () {
    var slider = $("#imageView"),
                 $li = null,
                 $img = null;
    $(slider).find("li:has(img)").each(function () {
        $li = $(this);
        $img = $li.find("img");
        centerImage($img);
    });
};


var redrawInterval = false,
    intervalKiller = false,
    visibilityTimer = false;
$(window).on("resize orientationchange", function () {
    $(".slide:not(.flex-active-slide) img.slideImg").css("visibility", "hidden");
    resizeHandler();

    // continue to recalculate in order to 
    // avoid any browser race-conditions
    clearTimeout(intervalKiller);
    clearTimeout(visibilityTimer);
    clearInterval(redrawInterval);

    redrawInterval = setInterval(function () {
        resizeHandler();
    }, 200);

    intervalKiller = setTimeout(function () {
        clearInterval(redrawInterval);
        resizeHandler();
    }, 1000);

    visibilityTimer = setTimeout(function () {
        $(".slideImg").css("visibility", "visible");
    }, 300);
    
});
*/