1
我有這樣的代碼:對自動配置功能窗口中的SVG調整
function myClient() {
if (!(this instanceof arguments.callee)) {
return new arguments.callee(arguments);
}
var self = this;
this.init = function() {
self.viewResized();
self.drawSvg();
};
this.viewResized = function() {
var width = $('body').width(),
windowHeight = $(window).height(),
svgCanvasHeight = width * (369.0/567.0);
$('#svg').css({
'margin-top': 10
});
}
this.drawSvg = function() {
// ...
}
var myClient;
jQuery(function() {
myClient = new myClient();
$(window).resize(function() {
console.log("window resized");
myClient.viewResized();
});
});
如何獲得svgCanvasHeight在drawSvg動態,這樣,當窗口大小,所以做了SVG的視框和SVG?