我在本地测试粒子滑块,并且它一直运行良好,直到我添加<!DOCTYPE html>
到文件中时,滑块图片有点循环而不到达最终阶段,并且它下面的内容开始以颤动的速度向下移动。
这是我从http://cssdeck.com/labs/interactive-particle-logo复制的代码(为了进行测试更改了图像)。
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>particle slider test</title>
<script src="http://code.jquery.com/jquery-latest.min.js"
type="text/javascript"></script>
</head>
<body style="margin: 0;">
<div id="particle-slider">
<div class="slides">
<div id="first-slide" class="slide" data-src="
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAIAAgAMBIgACEQEDEQH/xAAcAAABBAMBAAAAAAAAAAAAAAAGAAQFBwIDCAH/xABNEAABAgQCBQYICQoEBwAAAAABAgMABAURBhIHITFBURMiMmFxgRQjUpGhsbLRM0JDVHKSwdLwFTZTYmNzdIKT4UVklKIXJDREVbPC/8QAGgEBAAIDAQAAAAAAAAAAAAAAAAEEAgUGA//EACkRAAMAAQIDBgcAAAAAAAAAAAABAgMREgRBcRMhIzFRYQUUFTNSkbH/2gAMAwEAAhEDEQA/ALxhQoUAKFHilBKSpRsBviHnqorMW5YEqG3Xa3ad3rgCSfmmmemrXwG2IabxI0i/IDP9AZvTsiKmyVg8svlNd8uxPm98RU07tvAEomvTs7ONSrCUoU6oJCnHCQO4ARhiH8t0iT8Lcck3G84ScqFEi+/WYiaI5evyI/bCCyolNVerdDWRn5BDjV91xq8ygD3xIB/Dj1erjLz8uuRbbacyXWhYzG19VieIjTUcXTtDqr1PnW+UWzlutl02N0hWpKh1xN0oKocnh2kqGW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ovy/S+Kq2pY8k9fA/gVy+FtrUhxJStJspJFiDEg0uK1EGxBFiCLgiJ3DONKph0JYl3UTEkP+0mlGyR+zXtT2G47IHlqhm+5ugC9aZpMoEy2k1BTtMWQL+FJs33OC6T54e4krVKn8KVXwKpSb5XJuZQ2+lRPNO4GOdUTTzBJYdW39FVrxrcqDivhWpV7iXJdBv6IAM6K4lFAp5WtKR4K3rUbDoiMVVBl2/gpVNEfN05wO1XRHeRASas+2PENyjJ4tyrYI84hjPVCcnRabmnnkjYlSub5tkXPnrUKZRQ+nY3bun5hJVq9LtApcdS8rdLSzlwfpujVb9VHngQqdRfn3QuYUmyE5W20DKhtPBI3CNLiobqNzFS7q3rTLkRMLSVoYxulJd2bmW5eXQpx1xQSlKdpMeS0s9NPoYlm1OurNkoSLkxdejDR2pKuXmOnsefGxA8hHXxMYmZPaJsGtyEs2+6MyWlZioj4V33J/G+LVjXLsNSzKGWEBDaBZKRuEbIAUKFCgDB1pDzam3UhSFCxB3wCYrwO3NJU9LpUq2xSda0/eHpg+jy0Ac31ejztOzKcbK2h8ogXA7eEDzq7m8dQ1GjSU+CXW8rh+URqV/fvgIrejKWmlKWy20snXmR4pfuMSCjHFQ3cVFi1LRhPNE8kuZQP2jGcedJiCmMBVRBI5eX/mCkn1QAHOKhs4qDNGj6qPG3hEv/IFKPqiWp+iSdmFDl1zbg4NscmPrKMQCrXFRNUTCdSqxSvkzLy5PwroIv2DaYu+gaJZWSUlx1pllQPTX41z06h3RYFKoFPpllsNZ3h8q5zld3DugCv8C6MmZBoOzDa2kqHOK/hXfuj8dcWjLsNSzKGWG0ttoFkpSLARshQAoUKFAH//2Q==
">
</div>
</div>
<canvas class="draw" width="600" height="500"></canvas>
</div>
<div>
some content
</div>
<script class="cssdeck">// Tamino Martinius - All rights reserved
// Copyright © 2013 Tamino Martinius (http://zaku.eu)
// Copyright © 2013 Particleslider.com (http://particleslider.com
// Terms of usage: http://particleslider.com/legal/license
$(document).ready(function () {
var init = function(){
var isMobile = navigator.userAgent &&
navigator.userAgent.toLowerCase().indexOf('mobile') >= 0;
var isSmall = window.innerWidth < 600;
var ps = new ParticleSlider({
ptlGap: isMobile || isSmall ? 1 : 0,
ptlSize: isMobile || isSmall ? 1 : 1,
width: 1e9,
height: 1e9
});
(window.addEventListener
? window.addEventListener('click', function(){ps.init(true)}, false)
: window.onclick = function(){ps.init(true)});
}
var initParticleSlider = function(){
var psScript = document.createElement('script');
(psScript.addEventListener
? psScript.addEventListener('load', init, false)
: psScript.onload = init);
psScript.src = 'js/particle-slider.js';
psScript.setAttribute('type', 'text/javascript');
document.body.appendChild(psScript);
}
(window.addEventListener
? window.addEventListener('load', initParticleSlider, false)
: window.onload = initParticleSlider);
});
</script>
</body>
</html>