gpt4 book ai didi

javascript - 构造函数不初始化在线 Javascript

转载 作者:行者123 更新时间:2023-11-28 19:41:21 26 4
gpt4 key购买 nike

我只需要重新定位应用程序的元素。在本地启动但不在线部署。我也在使用“use strict”。

var winHeight=$(window).height();
var winWidth=$(window).width();


var Layout = function(){
this.half=480;
this.targetX=960;
this.targetY=527;
this.resultX=0;
this.resultY=0;
this.compute= function(xx,yy){
var reX = xx-this.targetX;
var reY = yy-this.targetY;
var teX = reX+this.targetX;
var teY = reY+this.targetY;
this.resultX=teX/this.targetX;
this.resultY=teY/this.targetY
};
};

var layout = new Layout();
layout.compute(winWidth,winHeight);

最佳答案

你只需要说:function ClassName()

function Layout() { 
...
};

关于javascript - 构造函数不初始化在线 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24959875/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com