Maison > interface Web > js tutoriel > le corps du texte

图片在浏览器中底部对齐 解决方法之一_jquery

WBOY
Libérer: 2016-05-16 17:58:59
original
1562 Les gens l'ont consulté

style="vertical-align:bottom;"不管用,上网搜索说要用js实现,找了个代码,测试不成功,主要是代码太多太乱没法心情测试了。
于是就自己写吧。

复制代码 代码如下:

$(function () {
if ($.browser.msie || $.browser.mozilla || $.browser.opera) {//IE 火狐 Opera之类浏览器
$(".productli img").each(function () {
var margin = 120 - $(this).height();
$(this).css("margin-top", margin + "px");
});
}
if ($.browser.safari) {//如果是苹果或chrome浏览器
$(".productli img").load(function () {
var margin = 120 - $(this).height();
$(this).css("margin-top", margin + "px");
});
}
})


经测试以下浏览器通过
IE6、 IE8、Chrome、 Opear、 FireFox、 QQ浏览器、 360、 傲游、 苹果
百度之类IE内核的就没测了肯定能用。
期待更精简代码出现。
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!