import '../scss/entry.scss' import util from './until' class Enter { constructor() { this.initPage() this.mouseMove() this.entryGame() } initPage() { $.ajax({ type: "GET", dataType: "json", url: `//video.duowan.com/jsapi/playPageVideoInfo/?vids=8890861`, success: function(data) { for(var i in data) { let resouce = util.deCodeArg(data[i].c).all, source = resouce.yuanhua || resouce[1300] || resouce[1000] || resouce[350]; document.getElementById('entry-video').src = source.src } } }) } mouseMove() { //获取div元素 var rec = document.getElementById("rec") document.onmousemove = function(e){ var ev = e || event; rec.style.top = ev.clientY - 97 + 'px'; rec.style.left = ev.clientX - 97 + 'px'; } } entryGame() { $(document).click(function(e) { var top = $('.aim-glass').css('top') top = top.replace('px','') var origin = top top = Number(top) - 100 document.getElementById('hunt-audio').play() $('.aim-glass').animate({top: top + 'px'}, 50).animate({top: origin + 'px'}, 400, function() { let link = $('.entry-text').attr('data-href') localStorage.setItem('entry', 'index'); window.location.href = link }); }) } } new Enter