简体   繁体   English

如何在JavaScript中按%(百分比)设置屏幕高度和宽度

[英]How to set the screen height and width by %(percentage) in javascript

i am using one plugin for slider. 我正在为滑块使用一个插件。 That slider contains H & W is mentioned by pixel. 包含H&W的滑块以像素表示。 I want that in % 我想要%

$("#section4").awShowcase(
    {
        content_width:          1000,
        content_height:         300,
}
});

They are mentioned by like this. 像这样被提及。 how to change this by % - Percentage. 如何通过%-百分比更改此值。

I want that for responsive model 我想要用于响应模型

$("#section4").awShowcase(
    {
        content_width:          100%,
        content_height:         30%,
  }
});

Is this what you looking for? 这是您要找的东西吗?

Try to use: 尝试使用:

$("#section4").awShowcase({
    content_width: '50%',
    content_height: '50%',
//}  // Remove this
}); 

Also, you're having redundant } in your code. 另外,您的代码中有多余的}

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

相关问题 打开不带地址栏和标题的javascript弹出窗口,标题和高度和宽度根据屏幕分辨率按百分比设置 - Opening javascript popup window without address bar and title with height and width set in percentage according to screen resolution 如果宽度为百分比,如何以px为单位设置图像高度? - How to set image height in px if the width is a percentage? 使用javascript设置屏幕方向,宽度和高度 - set screen orientation, width and height with javascript extJs(设置的高度和宽度),以百分比表示 - extJs (set height and width) in percentage javascript偏移宽度和高度(百分比) - javascript offset width and height in percentage 在JavaScript中将宽度和高度设置为百分比 - Setting width and height as a percentage in JavaScript 如何在JavaScript中获得准确的屏幕高度和宽度? - How to get accurate screen height and width in javascript? 如何在 JavaScript 中不断返回屏幕宽度/高度? - How to constantly return screen width/height in JavaScript? 如果使用 JavaScript 的百分比值,如何获得 CSS 的高度和宽度? - How to get CSS height and width if they are in percentage value using JavaScript? 加载后其元素的宽度/高度最初由PERCENTAGE设置的元素如何获得其实际宽度/高度? - How to get actual width/height of some element after loading whose width/height originally set by PERCENTAGE?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM