当窗口宽度减小时,如何使div消失?

时间:2021-12-21 19:45:46

I am trying to make my logo stay fixed on my header. Here is my example site: http://www.hidesertheat.com/test/index.html

我想让我的徽标固定在我的标题上。这是我的示例网站:http://www.hidesertheat.com/test/index.html

When the window is expanded to a certain height the logo (The sun) changes position. How can I make it fixed?

当窗口扩展到一定高度时,徽标(太阳)会改变位置。我怎样才能修好它?

Also I want the logo to disappear after a certain point of the window is reduced. How can this be done?

此外,我希望徽标在窗口的某个点减少后消失。如何才能做到这一点?

2 个解决方案

#1


1  

You can use css media queries. read examples here

您可以使用css媒体查询。在这里阅读示例

#2


0  

function setheight(){

var sliderheight = window.innerHeight - jQuery(".header").height();

liheight = sliderheight;

sliderheight = sliderheight+"px";

jQuery("div").css({"dispaly":"none"});

}

See the above example , It may help you

看上面的例子,它可能对你有所帮助

#1


1  

You can use css media queries. read examples here

您可以使用css媒体查询。在这里阅读示例

#2


0  

function setheight(){

var sliderheight = window.innerHeight - jQuery(".header").height();

liheight = sliderheight;

sliderheight = sliderheight+"px";

jQuery("div").css({"dispaly":"none"});

}

See the above example , It may help you

看上面的例子,它可能对你有所帮助