first commit
This commit is contained in:
BIN
assets/plugin/timeline/js/.DS_Store
vendored
Executable file
BIN
assets/plugin/timeline/js/.DS_Store
vendored
Executable file
Binary file not shown.
BIN
assets/plugin/timeline/js/._.DS_Store
Executable file
BIN
assets/plugin/timeline/js/._.DS_Store
Executable file
Binary file not shown.
BIN
assets/plugin/timeline/js/._main.js
Executable file
BIN
assets/plugin/timeline/js/._main.js
Executable file
Binary file not shown.
BIN
assets/plugin/timeline/js/._modernizr.js
Executable file
BIN
assets/plugin/timeline/js/._modernizr.js
Executable file
Binary file not shown.
26
assets/plugin/timeline/js/main.js
Executable file
26
assets/plugin/timeline/js/main.js
Executable file
@ -0,0 +1,26 @@
|
||||
jQuery(document).ready(function($){
|
||||
var timelineBlocks = $('.cd-timeline-block'),
|
||||
offset = 0.8;
|
||||
|
||||
//hide timeline blocks which are outside the viewport
|
||||
hideBlocks(timelineBlocks, offset);
|
||||
|
||||
//on scolling, show/animate timeline blocks when enter the viewport
|
||||
$(window).on('scroll', function(){
|
||||
(!window.requestAnimationFrame)
|
||||
? setTimeout(function(){ showBlocks(timelineBlocks, offset); }, 100)
|
||||
: window.requestAnimationFrame(function(){ showBlocks(timelineBlocks, offset); });
|
||||
});
|
||||
|
||||
function hideBlocks(blocks, offset) {
|
||||
blocks.each(function(){
|
||||
( $(this).offset().top > $(window).scrollTop()+$(window).height()*offset ) && $(this).find('.cd-timeline-img, .cd-timeline-content').addClass('is-hidden');
|
||||
});
|
||||
}
|
||||
|
||||
function showBlocks(blocks, offset) {
|
||||
blocks.each(function(){
|
||||
( $(this).offset().top <= $(window).scrollTop()+$(window).height()*offset && $(this).find('.cd-timeline-img').hasClass('is-hidden') ) && $(this).find('.cd-timeline-img, .cd-timeline-content').removeClass('is-hidden').addClass('bounce-in');
|
||||
});
|
||||
}
|
||||
});
|
1406
assets/plugin/timeline/js/modernizr.js
Executable file
1406
assets/plugin/timeline/js/modernizr.js
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user