Current File : /home/itiffy/public_html/public/js/portfolio-slider.js |
// JavaScript Document
/**/
function resizeIframe(obj) {
obj.style.height = 0;
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
$("#content_1").mCustomScrollbar("update");
}
function projectAnimate(x, y) {
if (y == 1) {
$('.project').animate({
'margin-top': parseInt(x) + $(window).height() + 'px'
}, 700, 'easeOutQuart');
} else {
$('.project').animate({
'margin-top': parseInt(x) - $(window).height() + 'px'
}, 700, 'easeOutQuart', function() {
if (parseInt($('ul.project').css('margin-top')) == -parseInt($('ul.project li').length - 1) * $(window).height()) {
$('ul.project').css('margin-top', '0px');
$('ul.projectList li').removeClass('active');
$('ul.projectList li:eq(0)').find('strong').stop(true, false).animate({
'width': '100%'
}, 100);
$('ul.projectList li:eq(0)').find('h3 span').css('color', '#FFF');
$('ul.projectList li:eq(0)').find('b').stop(true, true).fadeOut();
}
});
}
}
function projectInfoAnimate(x, y) {
if (y == 1) {
$('ul.projectInfo').animate({
'margin-top': parseInt(x) + $(window).height() + 'px'
}, 700, 'easeOutQuart', function() {
if (parseInt($('ul.projectInfo').css('margin-top')) == 0) {
$('ul.projectInfo').css('margin-top', '-' + parseInt($('ul.projectInfo').children('li').length - 1) * $(window).height() + 'px');
}
});
} else {
$('ul.projectInfo').animate({
'margin-top': parseInt(x) - $(window).height() + 'px'
}, 700, 'easeOutQuart');
}
}
function projectThumbList() {
$('.projectList li, .projectList li div').height($(window).height() / $('.projectList li').length);
if ($('.projectList li div').width() / $('.projectList li div').height() <= 1.5) {
var imgml = $('.projectList li div').width();
$('.projectList li div img').css({
'width': 'auto',
'height': '100%',
'margin-left': '-' + imgml / 2 + 'px',
'left': '50%'
});
} else {
$('.projectList li div img').css({
'width': '100%',
'height': 'auto',
'margin-left': '0px',
'left': '0'
});
}
}
function projectInfoHeight() {
$('.projectInfo li').height($(window).height());
}
function projectHeight() {
$('.project li, .project li img').height($(window).height());
$('.project li').each(function() {
// $(this).find('img').width($(this).find('img').width()).css('margin-left','-'+$(this).find('img').width()/2+'px');
$(this).find('img').css('margin-left', '-' + $(this).find('img').width() / 2 + 'px');
});
}
function projectThumbActive(x) {
$('ul.projectList li').removeClass('active');
$('ul.projectList li').find('strong').stop(true, false).animate({
'width': '0'
}, 300);
$('ul.projectList li').find('h3 span').css('color', '');
$('ul.projectList li').find('b').stop(true, true).fadeIn();
if (x == 1) {
var findindex = parseInt($('ul.project').css('margin-top')) / $(window).height() - 1;
} else {
var findindex = parseInt($('ul.project').css('margin-top')) / $(window).height() + 1;
}
var r = Math.abs(findindex);
$('ul.projectList li:eq(' + r + ')').find('strong').stop(true, false).animate({
'width': '100%'
}, 300);
$('ul.projectList li:eq(' + r + ')').find('h3 span').css('color', '#FFF');
$('ul.projectList li:eq(' + r + ')').find('b').stop(true, true).fadeOut();
$('.counter span').text('0' + parseInt(r + 1));
if ($('.counter span').text() == 07) {
$('.counter span').text('01');
}
}
function homecontResize() {
$('.homeContHolder').width($(window).width() - $('.column1').width());
$('.column3').css('left', $('.column2').width());
$('.homeproductDetails').css({
'width': $(window).width() - $('.column1').width() + 'px',
'left': '-' + $(window).width() - $('.column1').width() + 'px'
});
}
function projectinfoOrderChange() {
var mylist = $('ul.projectInfo');
var listitems = mylist.children('li').get();
listitems.reverse();
$.each(listitems, function() {
$('ul.projectInfo').append(this);
});
var projectInfoTopMargin = mylist.children('li').length - 1;
$('ul.projectInfo').css('margin-top', '-' + projectInfoTopMargin * $(window).height() + 'px');
}
////////////////////// mobille project slider ////////////////////////
$(function() {
if ($(window).width() >= 1000) {
$('body').css('overflow', 'hidden');
$('.project li:last-child').after($('.project li:eq(0)').clone());
$('.projectInfo li:last-child').after($('ul.projectInfo li:eq(0)').clone());
$('.mCSB_scrollTools .mCSB_buttonUp, .mCSB_scrollTools .mCSB_buttonDown, .sb, .sbClose').hide();
homecontResize()
projectThumbList();
projectInfoHeight();
projectHeight()
projectinfoOrderChange()
$(window).load(function() {
projectHeight()
})
$(window).resize(function() {
homecontResize()
projectThumbList();
projectInfoHeight();
projectHeight()
projectinfoOrderChange()
//projectAnimate(0,0)
})
$('.projectList li div').append('<b></b>');
$('.projectList li').append('<strong></strong>');
$('.projectList li:not(.active)').hover(function() {
$(this).find('strong').stop(true, false).animate({
'width': '100%'
}, 300);
$(this).find('b').stop(true, true).fadeOut();
},
function() {
$(this).find('strong').stop(true, false).animate({
'width': '0'
}, 300);
$(this).find('b').stop(true, true).fadeIn();
})
/////////////////////
$('.psNext').click(function() {
var findmargin = parseInt($('ul.projectInfo').css('margin-top'));
var findmargin2 = parseInt($('ul.project').css('margin-top'));
var projectLength = $('ul.project li').length;
if ($('ul.project').is(':animated')) {
return false
}
if (findmargin2 > -parseInt($('ul.project li').length - 1) * $(window).height()) {
projectAnimate(findmargin2, 0);
projectInfoAnimate(findmargin, 1);
projectThumbActive(1);
}
//projectCounter(1)
}) /// next click ///
$('.psPrev').click(function() {
var findmargin = parseInt($('ul.projectInfo').css('margin-top'));
var findmargin2 = parseInt($('ul.project').css('margin-top'));
var projectLength = $('ul.project li').length;
if ($('ul.project').is(':animated')) {
return false
}
if (findmargin2 < 0) {
projectAnimate(findmargin2, 1)
projectInfoAnimate(findmargin, 0);
projectThumbActive(0);
}
}) /// prev click ///
var bannerrun = setInterval("$('.psNext').click()", 3000);
$('.psNext, .psPrev, .projectInfo li, .project_details_link').mouseenter(function() {
clearInterval(bannerrun);
});
$('.projectList li').click(function() {
clearInterval(bannerrun);
$('ul.projectList li').find('strong').stop(true, false).animate({
'width': '0'
}, 300);
$('ul.projectList li').find('b').stop(true, true).fadeIn();
$('ul.projectList li').removeClass('active');
$(this).addClass('active');
$('.project').animate({
'margin-top': '-' + $(this).index() * $(window).height() + 'px'
});
$('ul.projectInfo').animate({
'margin-top': '-' + parseInt($('ul.projectList li').length - $(this).index()) * $(window).height() + 'px'
});
$('.counter span').text('0' + parseInt($(this).index() + 1));
});
////// home whats new ///////
$('.wnBtn').click(function() {
if ($('.wnCont').css('right') == '-280px') {
$('.wnCont').animate({
'right': '0'
});
$(this).addClass('wnBtnA');
} else {
$('.wnCont').animate({
'right': '-280px'
});
$('.wnBtn').removeClass('wnBtnA');
}
});
$('.wnClose').click(function() {
$('.wnCont').animate({
'right': '-280px'
});
$('.wnBtn').removeClass('wnBtnA');
});
////// home whats new ///////
$('.project_details_link').wrapInner('<b></b>');
$('.project_details_link').append("<span style='display:none'></span>");
$('.project_details_link').hover(function() {
$(this).find('span').stop(true, true).animate({
'left': '78px'
}).show();
$(this).find('b').stop(true, true).animate({
'left': '10px'
}).show();
},
function() {
$('.project_details_link span').fadeOut('first').animate({
'left': '75px'
});
$('.project_details_link b').animate({
'left': '22px'
});
})
/*$('.project_details_link').click(function() {
clearInterval(bannerrun);
$('.column2').animate({
'left': '800px'
}, 1000)
$('.column3').animate({
'left': '1285px'
}, 500)
$('.homeproductDetails').show().animate({
'left': '0'
}, 1000, function() {
if ($('.homeproductDetails').css('left') == '0px') {
clearInterval(bannerrun);
};
$('.mCSB_scrollTools .mCSB_buttonUp, .mCSB_scrollTools .mCSB_buttonDown, .sb, .sbClose').fadeIn()
})
})*/
$('.sbClose').click(function() {
$('.mCSB_scrollTools .mCSB_buttonUp, .mCSB_scrollTools .mCSB_buttonDown, .sb, .sbClose').fadeOut();
$('.column2').animate({
'left': '0px'
}, 1000);
$('.column3').animate({
'left': $('.column2').width()
}, 500);
$('.homeproductDetails').animate({
'left': '-' + $(window).width() - $('.column1').width() + 'px'
}, 1000, function() {
bannerrun = setInterval("$('.psNext').click()", 3000);
$('#contLoad').attr('src', '');
})
})
var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel" //FF doesn't recognize mousewheel as of FF3.x
$('.column2, .column3').bind(mousewheelevt, function(e) {
var evt = window.event || e //equalize event object
evt = evt.originalEvent ? evt.originalEvent : evt; //convert to originalEvent if possible
var delta = evt.detail ? evt.detail * (-40) : evt.wheelDelta //check for detail first, because it is used by Opera and FF
//scroll up
if (delta > 0) {
var findmargin = parseInt($('ul.projectInfo').css('margin-top'));
var findmargin2 = parseInt($('ul.project').css('margin-top'));
var projectLength = $('ul.project li').length;
if ($('ul.project').is(':animated')) {
return false
}
if (findmargin2 < 0) {
projectAnimate(findmargin2, 1)
projectInfoAnimate(findmargin, 0);
projectThumbActive(0);
}
} else {
//scroll down
var findmargin = parseInt($('ul.projectInfo').css('margin-top'));
var findmargin2 = parseInt($('ul.project').css('margin-top'));
var projectLength = $('ul.project li').length;
if ($('ul.project').is(':animated')) {
return false
}
if (findmargin2 > -parseInt($('ul.project li').length - 1) * $(window).height()) {
projectAnimate(findmargin2, 0);
projectInfoAnimate(findmargin, 1);
projectThumbActive(1);
}
}
});
}
/////////////// FOR MOBILE //////////////
if ($(window).width() < 1000) {
$('.projectInfo').wrap("<div class='piWrapMobile'></div>");
$('.projectInfo').width($(window).width() * $('.projectInfo li').length);
$('.column2, .project li, .piWrapMobile, .projectInfo li, .column3').width($(window).width());
$('.project li:first').before($('.project li:last'));
$('.project').css('margin-left', '-' + $(window).width() + 'px');
$('.projectInfo li:first').before($('.projectInfo li:last'));
$('.projectInfo').css('margin-left', '-' + $(window).width() + 'px');
$('.homeproductDetails').css('left', '-' + $(window).width() + 'px');
$('.psNext').click(function() {
$('.project').animate({
'margin-left': '-' + 2 * $(window).width() + 'px'
}, function() {
$('.project li:last').after($('.project li:first'));
$('ul.project').css('margin-left', '-' + $(window).width() + 'px');
});
$('.projectInfo').animate({
'margin-left': '-' + 2 * $(window).width() + 'px'
}, function() {
$('.projectInfo li:last').after($('.projectInfo li:first'));
$('ul.projectInfo').css('margin-left', '-' + $(window).width() + 'px');
});
var count = $('.counter span').text();
$('.counter span').text(parseInt(count) + 1);
if (count == 6) {
$('.counter span').text('1');
}
return false
})
$('.psPrev').click(function() {
$('.project').animate({
'margin-left': '0px'
}, function() {
$('.project li:first').before($('.project li:last'));
$('ul.project').css('margin-left', '-' + $(window).width() + 'px');
});
$('.projectInfo').animate({
'margin-left': '0px'
}, function() {
$('.projectInfo li:first').before($('.projectInfo li:last'));
$('ul.projectInfo').css('margin-left', '-' + $(window).width() + 'px');
});
var count = $('.counter span').text();
$('.counter span').text(parseInt(count) - 1);
if (count == 1) {
$('.counter span').text('6');
}
return false
})
$('.project_details_link').click(function() {
$('.homeproductDetails').show().animate({
'left': '0px'
});
$('#slidingNav').height($(document).height() - 55); //sliding nav resize
})
$('.sbClose').click(function() {
$('.homeproductDetails').show().animate({
'left': '-' + $(window).width() + 'px'
}, function() {
$('#slidingNav').height(0); //sliding nav resize
$('#slidingNav').height($(document).height() - 55); //sliding nav resize
});
})
$(window).resize(function() {
$('.projectInfo').width($(window).width() * $('.projectInfo li').length);
$('.column2, .project li, .piWrapMobile, .projectInfo li, .column3').width($(window).width());
$('.project li:first').before($('.project li:last')); //added 15-12-2015
$('.project').css('margin-left', '-' + $(window).width() + 'px'); //added 15-12-2015
$('.projectInfo li:first').before($('.projectInfo li:last')); //added 15-12-2015
$('.projectInfo').css('margin-left', '-' + $(window).width() + 'px'); //added 15-12-2015
$('.homeproductDetails').css('left', '-' + $(window).width() + 'px'); //added 15-12-2015
});
}
});
/*
*/
(function($){
$(window).on("load",function(){
$(".column4").mCustomScrollbar({
theme:"dark-3"
});
});
})(jQuery);