22 lines
613 B
JavaScript
22 lines
613 B
JavaScript
function powerhug() {
|
|
// Centerize
|
|
correctView();
|
|
$(window).resize(correctView);
|
|
|
|
parsePhotos();
|
|
}
|
|
|
|
function correctView() {
|
|
if ($(window).width() > $('#main').width()) {
|
|
$('#main').css('margin-left', (($(window).width() - $('#main').width()) / 2) + 'px');
|
|
}
|
|
}
|
|
|
|
function parsePhotos() {
|
|
$('#data-container img.photo').each(function(){
|
|
$(this).replaceWith($('<div>').addClass('photo rounded').css('background-image', 'url('+ $(this).attr('src') +')').width($(this).width()).height($(this).height()));
|
|
})
|
|
}
|
|
|
|
google.load('jquery', '1.4.4');
|
|
google.setOnLoadCallback(powerhug); |