Home page header is complete

This commit is contained in:
Asutosh Palai
2016-12-24 21:10:55 +05:30
parent 7161179222
commit 6e5186bda0
4 changed files with 190 additions and 125 deletions

View File

@ -1,10 +1,20 @@
// Your JavaScript
$(function() {
$('.img-center-fill').load(function(){
function gradeImage(){
var parent = $(this).parent();
var imgClass = (this.width/this.height > parent.width()/parent.height()) ? 'wide' : 'tall';
$(this).addClass(imgClass);
})
console.log(this);
}
$('.img-center-fill').each(function () {
if(this.complete) {
gradeImage.call(this);
}
else {
this.addEventListener('load', gradeImage);
}
});
/*
var switchPos = $('#new-articles').position().top + $('#new-articles').height();