Johani
(Joe)
3 يوليو 2022، 9:49م
2
مرحباً بك في Meta @zengyunsi
لا يمكنني إعادة إنتاج المشكلة التي ذكرتها. أرى هذا
أعتقد أن ما تراه يتعلق بهذا.
const declaredWidth = parseFloat(img.getAttribute("width"));
if (
isNaN(declaredHeight) ||
isNaN(declaredWidth) ||
img.style.aspectRatio
) {
return;
}
if (supportsAspectRatio) {
img.style.setProperty(
"aspect-ratio",
`${declaredWidth} / ${declaredHeight}`
);
} else {
// For older browsers (e.g. iOS < 15), we need to apply the aspect ratio manually.
// It's not perfect, because it won't recompute on browser resize.
// This property is consumed in `topic-post.scss` for responsive images only.
// It's a no-op for non-responsive images.
const calculatedHeight =
يعمل الاحتياطي --calculated-height فقط إذا كنت تستخدم متصفحًا لا يدعم خاصية CSS aspect-ratio. جميع المتصفحات المدعومة رسميًا بواسطة Discourse تدعم هذه الخاصية
هل يمكنك من فضلك مشاركة المتصفح الذي ترى فيه هذا؟
مرحباً، جواهاني، لقد جربت العديد من المتصفحات الصينية في الصين، ولدي هذه المشكلة. من الطبيعي اختبار جوجل وإيدج. شكراً جزيلاً لك!