Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turnjs翻页功能,在我使用transform: scale(0.56389, 0.56389) 通过js对不同电脑显示器进行适配操作时出现了bug,求解决方案! #665

Open
lvr1997 opened this issue Jan 27, 2022 · 5 comments

Comments

@lvr1997
Copy link

lvr1997 commented Jan 27, 2022

问题:我在通过js实现 对不同电脑显示器进行适配操作时,使用了如下代码:transform: scale(0.56389, 0.56389)
但是我发现,当我加上它之后,我点击书的右侧,他不能翻页了,

da6f0a26f12c676ed2c6403bbd0b538

当我将这段样式 从开发者模式中注销掉时,就恢复正常了。所以我现在搞不清楚,是什么原因引起的这一现象?求解决方案
1643248697(1)

如下 是我的相关代码:

//页面加载时执行
$(function() {
    calcRate()
    window.addEventListener('resize', resize)
})
//自适应translate(-50%, -50%)
function calcRate() {
	const appRef = document.getElementById("canvas")
	if(!appRef) return
	const currentRate = parseFloat((window.innerWidth / window.innerHeight).toFixed(5))
	if (appRef) {
	   if (currentRate > baseProportion) {
		 scale.width = ((window.innerHeight * baseProportion) / baseWidth).toFixed(5)
		 scale.height = (window.innerHeight / baseHeight).toFixed(5)
		 appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)`
	   } else {
		 scale.height = ((window.innerWidth / baseProportion) / baseHeight).toFixed(5)
		 scale.width = (window.innerWidth / baseWidth).toFixed(5)
		 appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)`
	   }
	}
}

function resize () {
	clearTimeout(drawTiming)
	drawTiming = setTimeout(() => {
	  this.calcRate()
	}, 200)
  }
@hyf-hub
Copy link

hyf-hub commented Nov 4, 2022

你可以使用 turn4 其中的size方法可以达到该效果

@hyf-hub
Copy link

hyf-hub commented Nov 4, 2022

你可以使用 turn4 其中的size方法可以达到该效果

https://github.com/blasten/Turn.js-4th-release

@asd8855
Copy link

asd8855 commented Apr 13, 2023

@hyf-hub 移动端旋转90度后,翻页位置错乱,这个该怎么解决,请求帮助

@flm995942878
Copy link

我最近刚遇到类似问题..... 页面缩放后需要计算偏移量。在翻页这里,需要将原来的e.pageX和e.pageY除以缩放量
即turn.js中 e.pageX/zoom ,e.pageY/zoom

@sslangss
Copy link

sslangss commented Nov 5, 2024

有没有前辈指导一下,如果这个作为商用需要弄什么不,虽然这是国外的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants