Pjax 라이브러리 (jquery pjax 포트)를 사용하는 사이트를 개발 중입니다. 그러나 터치 이벤트는 진행되지 않습니다. 다음과 같이 Pjax를 사용하고 있습니다.
var pjax = new Pjax({ selectors: ["head title", "body"] })
또한 몇 가지 애니메이션이 있습니다.
document.addEventListener('pjax:send', function(){
var $main = document.querySelector('main')
$main.style.opacity = 0
})
document.addEventListener('pjax:complete', function(){
var $main = document.querySelector('main')
$main.style.visibility = 'hidden'
$main.style.opacity = 0
setTimeout(function(){
document.querySelector('main').style.visibility = 'visible'
document.querySelector('main').style.opacity = 1
attach_menu_control()
}, 10)
})
모바일에서 작동하려면 필요합니다. 사이트는 www.saulesinterjerai.lt입니다 (버그가있을 수 있음)
해결책을 찾았으며 다음과 같이 터치 이벤트를 클릭 이벤트로 리디렉션하여 작동합니다.
if (is_touch_device()) {
var all_links = document.querySelectorAll('a[href]')
var event = new Event('click');
for (var index = 0 ; index < all_links.length ; ++index) {
all_links[index].addEventListener("touchend", function() {
all_links[index].dispatchEvent(event)
});
}
}
function is_touch_device() {
return 'ontouchstart' in window // works on most browsers
|| navigator.maxTouchPoints; // works on IE10/11 and Surface
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다