私は変換を使用してフルサイズに画像を拡大しようとしています。スケールを調整し、次にスケールする?
これは私がトップとポジションを計算しようとする方法ですが、ほとんど動作しますが、変換は画像の元のサイズに基づいています。どういうわけか別のCSSを適用することでこれを解決できますか、別の翻訳値を把握する必要がありますか?
transformCarousel() {
if (this.state.zoom) {
const heightBefore = this.state.carousel.height
const heightAfter = window.innerHeight * 0.792
const scale = heightAfter/heightBefore
const posBefore = this.state.carousel.top
const posAfter = window.pageYOffset
const translate = posAfter - posBefore
return {
zIndex: 1070,
transform: 'scale(' + scale + ') translateY(' + translate + 'px)'
}
}
}
になります変換されますその問題を再現する最小限のコードスニペットを投稿する必要があります。また、私はあなたの質問にjavascriptでタグを付けましたが、jQueryも使用しますか? – LGSon