TA的每日心情 | 奋斗 2022-9-1 11:24 |
---|
签到天数: 50 天 连续签到: 1 天 [LV.5]常住居民I 766680204
|
前端代码
<a class="navbar-brand" href="/"><img id="ffidc" style="width:100%;height:auto;padding-top:5px" /></a>
js代码
<script>
$(document).ready(function() {
if($(window).width() > 991) {
$("#ffidc").attr("src", "../assets/img/features/cleardent-header.png");
} else {
$("#ffidc").attr("src", "../assets/img/features/cleardent-header-small.png");
}
});
</script>判断宽度显示和隐藏js代码
<script>
$(document).ready(function() {
if($(window).width() >= 1200 ) {
$("#ffidc").attr("src", "/static/images/logo.png");
document.getElementById('ffidc1').style.display = 'none'; //隐藏
} else {
$("#ffidc").attr("src", "/static/images/logo1.png");
}
});
</script>
|
|