Highlighted

Animate Responsive Site Problem

New Here ,
Feb 17, 2020

Copy link to clipboard

Copied

Hi! im working with this code:

var page_body = document.getElementsByTagName("body")[0];
page_body.style.backgroundColor = "#000000";

var page_canvas = document.getElementsByTagName("canvas")[0];
stageWidth = page_canvas.width;
stageHeight = page_canvas.height;

var r = this;

function onResize() {
if(page_canvas.width <= 700) { 
	//page_body.style.backgroundColor = "#000000";
	r.Contents.gotoAndStop(1);
	lib.properties = {width: 750, height: 1097};
	}
	else{
	//page_body.style.backgroundColor = "#000000";
	r.Contents.gotoAndStop(0);
	lib.properties = {width: 1358, height: 601};
	}
}

window.onresize = function () {
 onResize();
}

onResize();

The idea of ​​this code is that when you see the main scene, if the width of the browser is less than 700px changes the size of the canvas of the document, and at the same time a frame changes to show a new layout, but it seems that it does not work correctly, they can Help me find what I am wrong at?

TOPICS
Code, How to

Views

30

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Animate Responsive Site Problem

New Here ,
Feb 17, 2020

Copy link to clipboard

Copied

Hi! im working with this code:

var page_body = document.getElementsByTagName("body")[0];
page_body.style.backgroundColor = "#000000";

var page_canvas = document.getElementsByTagName("canvas")[0];
stageWidth = page_canvas.width;
stageHeight = page_canvas.height;

var r = this;

function onResize() {
if(page_canvas.width <= 700) { 
	//page_body.style.backgroundColor = "#000000";
	r.Contents.gotoAndStop(1);
	lib.properties = {width: 750, height: 1097};
	}
	else{
	//page_body.style.backgroundColor = "#000000";
	r.Contents.gotoAndStop(0);
	lib.properties = {width: 1358, height: 601};
	}
}

window.onresize = function () {
 onResize();
}

onResize();

The idea of ​​this code is that when you see the main scene, if the width of the browser is less than 700px changes the size of the canvas of the document, and at the same time a frame changes to show a new layout, but it seems that it does not work correctly, they can Help me find what I am wrong at?

TOPICS
Code, How to

Views

31

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 17, 2020 0

Have something to add?

Join the conversation