简体   繁体   English

与屏幕分辨率的链接

[英]Link with Screen Resolution

I am making a website that houses an animation and the resolution is 1024x768.我正在制作一个包含动画的网站,分辨率为 1024x768。 The link for the website will be sent out as a Holiday greeting via email.该网站的链接将作为节日问候通过电子邮件发送。 Is there a way to prevent the website from loading in a different resolution than 1024x768 regardless of their screen resolution?有没有办法阻止网站以与 1024x768 不同的分辨率加载,而不管其屏幕分辨率如何?

Thank you!谢谢!

If You want to only hide the content I would use media queries:如果您只想隐藏内容,我将使用媒体查询:
http://css-tricks.com/css-media-queries/ http://css-tricks.com/css-media-queries/

But if You have tracking pixels which You don't want to download I would insert an iframe if the screen resolution fits Your requirements:但是,如果您有不想下载的跟踪像素,如果屏幕分辨率符合您的要求,我会插入一个 iframe:

if ( ($(window).height() === 768) && ($(window).width() === 1024) ) {
  $('body').append('<iframe src="http://your.url.com"></iframe>');
}

just embed your content in a div setting the width and height to your desired values.只需将您的内容嵌入到div中,将widthheight设置为您想要的值。

But a more robust solution would be to use media queries.但更强大的解决方案是使用媒体查询。 http://www.w3.org/TR/css3-mediaqueries/ http://www.w3.org/TR/css3-mediaqueries/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM