캔 캔버스를 주로 사용하는 웹 사이트를 구축하면 캔버스가 포함 된 유일한 캔버스가 가로로 그려지며 줄은 약 13000 픽셀입니다.자바 스크립트 메모리 누수 - 캔버스 HTML5 jQuery
사용자가 내 창을 스크롤하면 m 캔버스 경로를 따라 가로로 스크롤합니다 (Example).
파이어 폭스 (버전 6.0.2)에서 내 문서를 스크롤하지 못했습니다. 내 콘솔에서 나는 (NS_ERROR_OUT_OF_MEMORY) 라인을 따라 무언가를받습니다.
Google 검색 결과 잠재적 인 메모리 누수가 될 수 있다는 사실을 발견했습니다. 이 코드는 어떻게 작동합니까? 코드 작성 방법 때문입니까? 또는 브라우저/하드웨어 문제입니까?
Im은 창 크기 조정 등에 대한 내 기능을 다시 초기화하고 이것이 어떤 imapct를 가질 수 있는지 궁금합니다.
// Initate the plugin
$(window).resize(function() {
if(this.resizeTO) clearTimeout(this.resizeTO);
this.resizeTO = setTimeout(function() {
$(this).trigger('resizeEnd');
}, 500);
});
$(window).bind('resizeEnd', function() {
$("#path").scrollPath({drawPath: true, wrapAround: false});
});
$("#path").scrollPath({drawPath: true, wrapAround: false});
$(document).ready(init);
$('.wrapper').css({'top' : '0px','left' : '0px'});
$('.wrapper > div').css({'height' : + $(window).height() +'px'});
function init() {
// Set window height and width variables
var windowheight = $(window).height();
var windowwidth = $(window).width();
// Check monitor size and workot if incentives needs extra space etc
var bff = 4020 + (1993 - windowwidth);
// Move divs into position
$('.culture').css('top', + - windowheight + 'px');
$('.careerpath').css('top', + - windowheight + 'px');
$('.training').css('top', + - windowheight + 'px');
$('.apply').css('top' , + - windowheight + 'px');
/* ========== DRAWING THE PATH AND INITIATING THE PLUGIN ============= */
$.fn.scrollPath("getPath")
// Move to 'start' element
.moveTo(0, 0, {name: "div"})
.lineTo(2400, 0, {name: "div1"})
.lineTo((bff-550), 0, {name: "div2"})
.lineTo(bff, 0, {name: "div3"})
.lineTo(bff, -windowheight, {name: "div4"})
.lineTo((bff + 1993), -windowheight, {name: "div5"})
.lineTo((bff + 1993 + 1837), -windowheight, {name: "div6"})
.lineTo((bff + ((1993 + 1837 + 1795) - 325)), -windowheight, {name: "div7"})
// We're done with the path, let's initate the plugin on our wrapper element
// Window resize function
$(window).resize(function() {
if(this.resizeTO) clearTimeout(this.resizeTO);
this.resizeTO = setTimeout(function() {
$(this).trigger('resizeEnd');
}, 500);
});
$(window).bind('resizeEnd', function() {
$("#path").scrollPath({drawPath: true, wrapAround: false});
});
$("#path").scrollPath({drawPath: true, wrapAround: false});
}
나는 캔버스에 13000 픽셀 길이의 선을 그려야합니까? – Blazemonger
사용자가 스크롤 할 때 문자가 왼쪽에서 오른쪽으로 걷고 다른 층으로 엘리베이터를 올라가는 문자 기반 웹 사이트를 구축합니다 ... – Liam
캔버스에서의 경험은 존재하지 않지만 왜 더 작은 캔버스와 스크롤을 만드 시죠? 대신 배경? – Blazemonger