Javascript 为什么不';从手机查看时,网页链接是否可点击?
这就是我目前所拥有的。我在Chrome中使用移动调试模式来排除故障。我还将它启动到服务器上,以确保它不仅仅是关闭了chrome。如果你觉得简单的话,给我一个建议或叉子,我将不胜感激 只是想清楚地重申一下这个问题:为什么在Chrome浏览器中,从mobile inspect模式查看时,下拉菜单链接不起作用 似乎是javascript导致了这些问题:Javascript 为什么不';从手机查看时,网页链接是否可点击?,javascript,debugging,mobile,web,Javascript,Debugging,Mobile,Web,这就是我目前所拥有的。我在Chrome中使用移动调试模式来排除故障。我还将它启动到服务器上,以确保它不仅仅是关闭了chrome。如果你觉得简单的话,给我一个建议或叉子,我将不胜感激 只是想清楚地重申一下这个问题:为什么在Chrome浏览器中,从mobile inspect模式查看时,下拉菜单链接不起作用 似乎是javascript导致了这些问题: //javascript for pixel art let width, height; let pixels = []; let colored
//javascript for pixel art
let width, height;
let pixels = [];
let coloredPixels = [];
let colors = ['#540045', '#C60052', '#FF714B', '#EAFF87', '#ACFFE9'];
let currentPixel = 0;
const mousePosition = { x: window.innerWidth/2, y: window.innerHeight/2 };
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const drawGrid = () => {
ctx.clearRect(0, 0, width, height);
for (var i = 0, l = pixels.length; i < l; i++) {
pixels[i][4] = 0;
}
for (var i = 0, l = coloredPixels.length; i < l; i++) {
var pix = Math.floor(coloredPixels[i].y/10)*(Math.floor(width/10)+1) + Math.floor(coloredPixels[i].x/10);
if (pixels[pix]) {
pixels[pix][4] = coloredPixels[i].color;
pixels[pix][5] = coloredPixels[i].alpha;
}
if (coloredPixels[i].alpha > 0) coloredPixels[i].alpha -= 0.008;
if (coloredPixels[i].alpha < 0) coloredPixels[i].alpha = 0;
coloredPixels[i].x += coloredPixels[i].vx;
coloredPixels[i].y += coloredPixels[i].vy;
}
for (var i = 0, l = pixels.length; i < l; i++) {
ctx.globalAlpha = 1;
ctx.fillStyle = '#222';
ctx.fillRect(pixels[i][0], pixels[i][1], pixels[i][2], pixels[i][3]);
ctx.globalAlpha = pixels[i][5];
ctx.fillStyle = pixels[i][4];
ctx.fillRect(pixels[i][0], pixels[i][1], pixels[i][2], pixels[i][3]);
}
}
const resize = () => {
width = window.innerWidth;
height = window.innerHeight;
canvas.width = width;
canvas.height = height;
pixels = [];
for (var y = 0; y < height/10; y++) {
for (var x = 0; x < width/10; x++) {
pixels.push([x*10, y*10, 8, 8, '#222', 1]);
}
}
}
const draw = () => {
launchPixel();
launchPixel();
drawGrid();
requestAnimationFrame(draw);
}
const initColoredPixels = () => {
for (var i = 0; i < 300; i++) {
coloredPixels.push({
x: width/2,
y: height/2,
alpha: 0,
color: colors[i%5],
vx: -1 + Math.random()*2,
vy: -1 + Math.random()*2
})
}
}
const launchPixel = () => {
coloredPixels[currentPixel].x = mousePosition.x;
coloredPixels[currentPixel].y = mousePosition.y;
coloredPixels[currentPixel].alpha = 1;
currentPixel++;
if (currentPixel > 299) currentPixel = 0;
}
resize();
initColoredPixels();
draw();
window.addEventListener('resize', resize);
window.addEventListener('mousemove', function(e) {
mousePosition.x = e.pageX;
mousePosition.y = e.pageY;
})
const touchMove = (e) => {
e.preventDefault();
mousePosition.x = e.touches[0].pageX;
mousePosition.y = e.touches[0].pageY;
}
document.addEventListener('touchstart', touchMove);
document.addEventListener('touchmove', touchMove);
// javascript for hamburger
$( document ).ready(function() {
var hamburger = $('#hamburger-icon');
hamburger.bind("mouseup", handleHam);
hamburger.bind("touchend", handleHam);
});
function handleHam() {
$(this).toggleClass('active');
if($('.nav-menu').is(':hidden')){ // check to see if menu is hidden
$('.nav-menu').slideDown();} // if so slide down
else{$('.nav-menu').slideUp();} // else slide up
return false;
}
//用于像素艺术的javascript
让宽度、高度;
设像素=[];
设彩色像素=[];
让颜色=['#540045'、'#C60052'、'#FF714B'、'#EAFF87'、'#ACFFE9'];
设currentPixel=0;
常量mousePosition={x:window.innerWidth/2,y:window.innerHeight/2};
const canvas=document.getElementById('canvas');
const ctx=canvas.getContext('2d');
常量drawGrid=()=>{
ctx.clearRect(0,0,宽度,高度);
对于(变量i=0,l=pixels.length;i0)彩色像素[i].alpha-=0.008;
如果(彩色像素[i].alpha<0)彩色像素[i].alpha=0;
彩色像素[i].x+=彩色像素[i].vx;
彩色像素[i].y+=彩色像素[i].vy;
}
对于(变量i=0,l=pixels.length;i{
宽度=window.innerWidth;
高度=窗内高度;
画布宽度=宽度;
canvas.height=高度;
像素=[];
对于(变量y=0;y{
启动像素();
启动像素();
drawGrid();
请求动画帧(绘制);
}
常量initColoredPixels=()=>{
对于(变量i=0;i<300;i++){
彩色像素推送({
x:宽度/2,
y:高度/2,
阿尔法:0,
颜色:颜色[i%5],
vx:-1+数学随机()*2,
vy:-1+数学随机()*2
})
}
}
常量启动像素=()=>{
彩色像素[currentPixel].x=鼠标位置.x;
彩色像素[currentPixel].y=鼠标位置.y;
彩色像素[currentPixel].alpha=1;
currentPixel++;
如果(currentPixel>299)currentPixel=0;
}
调整大小();
initColoredPixels();
draw();
window.addEventListener('resize',resize);
window.addEventListener('mousemove',函数(e){
mousePosition.x=e.pageX;
mousePosition.y=e.pageY;
})
const touchMove=(e)=>{
e、 预防默认值();
mousePosition.x=e.touchs[0].pageX;
mousePosition.y=e.touchs[0].pageY;
}
文档。addEventListener(“touchstart”,touchMove);
文件。添加的文件列表器('touchmove',touchmove);
//汉堡的javascript
$(文档).ready(函数(){
var汉堡=$(“#汉堡图标”);
汉堡包。绑定(“mouseup”,handleHam);
汉堡包。绑定(“触摸端”,handleHam);
});
函数handleHam(){
$(this.toggleClass('active');
如果($('.nav menu')。是(':hidden'){//检查菜单是否隐藏
$('.nav menu').slideDown();}//如果是,请向下滑动
else{$('.nav menu').slideUp();}//else向上滑动
返回false;
}