/* Delighters - Add CSS animations to delight users as they scroll down. (c) 2018 - Q42 Written by Martin Kool https://github.com/Q42/delighters */ var Delighters = new (function() { var self = this, dels = this.dels = [], // default options options = { attribute: 'data-delighter', classNames: ['delighter', 'started', 'ended'], start: 0.75, // default start threshold end: 0.75, // default end threshold autoInit: true // initialize when DOMContentLoaded }; document.addEventListener("DOMContentLoaded", function() { if (options.autoInit) init(); }); function config(opts) { for (var name in opts) options[name] = opts[name]; } function init() { document.addEventListener('scroll', scroll) var els = document.querySelectorAll('[' + options.attribute + ']'); for (var i=0; i= 0 && factorStart <= 1) { if (!del.startLine) { del.startLine = document.createElement('div') document.body.appendChild(del.startLine); del.startLine.style = 'position:fixed;height:0;width:100%;border-bottom:dotted red 2px;top:' + (del.start * 100) + 'vh'; } } if (((factorEnd < del.end) || (factorStart > 1)) && del.startLine) { del.startLine.parentNode.removeChild(del.startLine); delete del.startLine; } } if (factorStart < del.start && !del.started) { del.started = true; del.el.classList.add(options.classNames[1]) } else if (factorStart > del.start && del.started) { del.started = false; del.el.classList.remove(options.classNames[1]) } if (factorEnd < del.end && !del.ended) { del.ended = true; del.el.classList.add(options.classNames[2]) } else if (factorEnd > del.end && del.ended) { del.ended = false; del.el.classList.remove(options.classNames[2]) } } } self.init = init; self.config = config; })(); //婊氬姩鏉′簨浠 $(window).scroll(function(){ var windouWidth = $(this).width();//鑾峰彇娴忚鍣ㄨ嚜韬搴 var windouHeight = $(this).height();//鑾峰彇娴忚鍣ㄨ嚜韬珮搴 //鑾峰彇瑕佸畾浣嶅厓绱犺窛绂绘祻瑙堝櫒椤堕儴鐨勮窛绂 if($("#update_itera .up_it_video").offset()){ var navH = $("#update_itera .up_it_video").offset().top - 70; if(windouWidth<1366){ navH -= $("#update_itera .up_it_video").height()/3 } //鑾峰彇婊氬姩鏉$殑婊戝姩璺濈 var scroH = $(this).scrollTop(); //婊氬姩鏉$殑婊戝姩璺濈澶т簬绛変簬瀹氫綅鍏冪礌璺濈娴忚鍣ㄩ《閮ㄧ殑璺濈 if(scroH>=navH){ $(".up_it").css({height:"200vh"}) $("#update_itera .up_it_video").css({width: "100%",position:"fixed"}) $("#update_itera .back_black").stop().fadeIn() }else if(windouWidth>1366 && scroH scroH){ $("#update_itera .up_it_video").css({position:"relative"}) $(".up_it").css({height:"auto"}) } // if($(".up_it").height()+$(".up_it").offset().top < scroH+windouHeight){ // $("#update_itera .up_it_video").css({position:"relative"}) // // $(".up_it").css({height:"auto"}) // } }