动画宽度切换时,它不是动画填充,所以我查看.outerWidth(),但我不确定如何实现这个...
$('#shareheart').click(function(){
$('.share-text').animate({outerWidth: 'toggle'}, 2000)
})
Run Code Online (Sandbox Code Playgroud) 如何设置div使用JavaScript 的宽度和高度?
这是我的代码
<%@page import="org.json.JSONObject"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>View JSON</title>
<script type="text/javascript">
var rect1='{"minX": 0.0,"minY": 0.0,"maxX": 2460.0,"maxY": 3008.0}';
var rectangle = JSON.parse(rect1);
var maxx=rectangle.maxX;
var maxy=rectangle.maxY;
***What should i do here?***
</script>
</head>
<body>
<h5>JSON View</h5>
<div id="set">
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我想将div宽度设置maxx为maxyvalue ,将height设置为值.我也想设置它的边界,1px以便我可以看到它是否正常工作.
谢谢
我有一个在localhost上运行的程序,全屏使用chrome.当我输入控制台时
window.innerWidth
Run Code Online (Sandbox Code Playgroud)
我得到了1236的结果.当我在任何其他网页(不是localhost)上这样做时,我得到1360(正如我所料).
我完全不知道为什么会这样.由于该程序适用于1360x768和1920x1080,因此它的设计非常糟糕.
任何想法为什么会发生?
我正在编写一个计算最大高度/宽度的函数,并使元素具有相同的高度/宽度.我想将2个参数传递给此函数:
1. The selector, which can be(element, class )
2. jQuery `width()` / `height()` function
Run Code Online (Sandbox Code Playgroud)
并且期望的结果应该是看起来像的功能..
Eg 1. equalDimensions('.class', width() ); OR
Eg 2. equalDimensions( div, height() );
Run Code Online (Sandbox Code Playgroud)
并根据传递给函数的内容width()/ height()它将计算最大高度/宽度,并使所有作为第一个参数传递的选择器等于宽度/高度.
作为jQuery的新手,我正在努力将其放入代码中.
这是我到目前为止所尝试的......
var equalDimension = function( selector, fn ){
var dimension = fn();
var biggestDimemsion = 0;
$(selector).each(function(){
if($(this).dimension > biggestDimemsion){
biggestDimemsion = $(this).dimension;
}
});
$(selector).each(function(){
$(this).dimension(biggestDimemsion);
});
};
Run Code Online (Sandbox Code Playgroud) 我创建了一个带有一些控件的对话框 -
IDD_DIALOG_EFFECTS DIALOGEX 0, 0, 168, 49
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 400, 0, 0x1
BEGIN
--- ---
--- ---
CTEXT "",3,200,120,60,60, WS_VISIBLE
END
Run Code Online (Sandbox Code Playgroud)
在Header中 - 文件:const int16 kItem = 3;
现在,当我试图获得控件的位置和尺寸时,它并不准确.
// Retrieving the location and dimension of the control
RECT wRect_proxy;
GetWindowRect(GetDlgItem(hDlg, kItem), &wRect_proxy);
ScreenToClient (hDlg, (LPPOINT)&wRect_proxy);
ScreenToClient (hDlg, (LPPOINT)&(wRect_proxy.right));
// Output of the control as location and position that I am getting is:
wRect_proxy.left: 300 (Expected: 200)
wRect_proxy.top: 195 (Expected: 120)
wRect_proxy.right: …Run Code Online (Sandbox Code Playgroud) 这是一个简单的CSS问题,但我还没有任何线索.我有几个带有背景颜色的p标签,我的问题是背景扩展到每个标签的屏幕的100%,我只是想包装单词,创建效果作为buttoms或block.我不明白为什么p背景会达到所有宽度.
小提琴:这里的确切示例
<div class="process_wrapper_mobile">
<div class="inter_mobile_process">
<p>Interview</p>
</div>
<div class="inter_mobile_process">
<p>Data reception</p>
</div>
<div class="inter_mobile_process">
<p>Design</p>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.process_wrapper_mobile {
position: relative;
float: left;
width: 100%;
height: auto;
background-color: #CCC;
}
.process_wrapper_mobile .inter_mobile_process {
position: relative;
float: left;
width: 100%;
height: auto;
margin-bottom: 3%;
}
.process_wrapper_mobile .inter_mobile_process p {
text-align: center;
color: #fff;
font-size: 0.9em;
background-color: #333;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 3% 5%;
}
Run Code Online (Sandbox Code Playgroud)
请检查我的小提琴.
谢谢!
我已经使用此代码制作了一个ImageButton&之后我想在运行时更改它的大小.这两个代码都写在下面,
<ImageButton
android:id="@+id/btn_new"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/untitled3"
/>
Run Code Online (Sandbox Code Playgroud)
public void scaler1() {
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
btn_new.setMinimumWidth(width/4);
btn_new.setMinimumHeight(height/6);
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用请给出任何解决方案.
这是我正在使用的实际代码
public void scaler1() {
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
edit_screen.setWidth(width);
edit_screen.setHeight(height / 6);
lpsame = (LayoutParams) btn_0.getLayoutParams();
lpsame.width=width/4;
lpsame.height=height/6;
btn_0.setLayoutParams(lpsame);
LayoutParams lpedit = (LayoutParams) edit_screen.getLayoutParams();
lpedit.width=width;
lpedit.height=height/6;
LayoutParams lpequal = (LayoutParams) btn_0.getLayoutParams();
lpequal.width=width/2;
lpequal.height=height/6;
edit_screen.setLayoutParams(lpedit);
btn_2.setLayoutParams(lpsame);
btn_3.setLayoutParams(lpsame);
btn_4.setLayoutParams(lpsame);
btn_5.setLayoutParams(lpsame);
btn_6.setLayoutParams(lpsame);
btn_7.setLayoutParams(lpsame);
btn_8.setLayoutParams(lpsame);
btn_9.setLayoutParams(lpsame);
btn_add.setLayoutParams(lpsame);
btn_subtrac.setLayoutParams(lpsame); …Run Code Online (Sandbox Code Playgroud) 我需要添加boostrap容器+ 60px.
我怎么能这样做,没有changin boostrap本身?
我试过这个媒体查询,但它不起作用.
@media (min-width: 1200px) {
.container{
max-width: 1260px;
}
}
Run Code Online (Sandbox Code Playgroud)
你能帮帮我吗?谢谢 :)
Angular2/Typescript中是否有一种方法可以检测div是否因文本溢出而取决于屏幕的宽度.如果文本溢出,我想显示"更多"按钮.右侧还有一个书签图标,所以我必须考虑到div的宽度.
在我的HTML中:
<div *ngFor="let i of items"> {{ i }}
<i class="fa fa-bookmark" aria-hidden="true"></i>
</div>
//If the text is overflow
<button *ngIf="overflow"> More </button>
Run Code Online (Sandbox Code Playgroud)
在我的打字稿中:
@HostListener('window', ['$event'])
public checkOverflow() {
console.log(event.target.innerWidth)
}
Run Code Online (Sandbox Code Playgroud)
问题是如何考虑到侧面有其他元素,如何找出div宽度.还有另一种方法来检查字符串是否在javascript/typescript方面溢出?
我在一个项目上具有以下CSS属性:
width: calc(100%- 40px);
width: -moz-calc(100% - 40px);
Run Code Online (Sandbox Code Playgroud)
但是Firefox表示它们都是无效的属性值。这是Firefox的错误,还是有一种新的宽度方法:Firefox中的calc?