我想要一个模态加载微调器,并在Bootstrap 4的模态对话框中进行测试.但是,我无法将模态水平居中在页面上.如果可能的话,我也希望模态没有边框和透明(所以看起来只有微调器悬停在页面上)
function modal(){
$('.modal').modal('show');
setTimeout(function () {
console.log('hejsan');
$('.modal').modal('hide');
}, 3000);
}
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js" integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>
<button type="button" class="btn btn-primary" onclick="modal();">Open and close in 3 secs</button>
<div class="modal fade bd-example-modal-lg" data-backdrop="static" data-keyboard="false" tabindex="-1">
<div class="modal-dialog modal-sm">
<div class="modal-content" style="width: 48px">
<span class="fa fa-spinner fa-spin fa-3x"></span>
</div>
</div>
</div>
<p>I would like the <ul><li>spinner horizontally centered on page<li> the modal transparent without borders</ul></p>
Run Code Online (Sandbox Code Playgroud)
我有以下雄辩的模型:
用户 | ID
发布 | ID
评论 | id | post_id | 用户身份
使用eloquent,我如何获取特定用户尚未评论的所有帖子?
我到目前为止尝试过:
在模型岗位:
public function noCommentOf(User $user) {
$this->hasNot('App\Comment')->commentOf($user);
}
Run Code Online (Sandbox Code Playgroud)
在模型评论中:
public function commentOf($query, User $user) {
return $query->where('user_id', '=', $user->id);
}
Run Code Online (Sandbox Code Playgroud) 假设这是我的表:
ID NUMBER DATE
------------------------
1 45 2018-01-01
2 45 2018-01-02
2 45 2018-01-27
Run Code Online (Sandbox Code Playgroud)
我需要使用 partition by 和 row_number 分开,其中一个日期和另一个日期之间的差异大于 5 天。上面例子的结果是这样的:
ROWNUMBER ID NUMBER DATE
-----------------------------
1 1 45 2018-01-01
2 2 45 2018-01-02
1 3 45 2018-01-27
Run Code Online (Sandbox Code Playgroud)
我的实际查询是这样的:
SELECT ROW_NUMBER() OVER(PARTITION BY NUMBER ODER BY ID DESC) AS ROWNUMBER, ...
但正如您所注意到的,它不适用于日期。我怎样才能做到这一点?
我已粘贴了一个独立的HTML代码,有助于理解.我想在更改一个下拉列表时显示隐藏两个输入字段.
我没有错.
任何人都可以告诉我什么是错的,需要修理吗?
$(document).ready(function() {
$('#containerId').find('select[name="Field"]').live('change', function(){
var fieldi = $(this).val();
if(fieldi.length > 1 && fieldi=='4') {
$(this).parent().children('div.formRow' ).find('.FieldName').hide();
$(this).parent().children('div.formRow' ).find('.dropdownName').show();
}
if(fieldi.length > 1 && fieldi=='2') {
$(this).parent().children('div.formRow' ).find('.FieldName').show();
$(this).parent().children('div.formRow' ).find('.dropdownName').hide();
}
});
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<div id='#containerId'>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<fieldset name="fieldset1" namex="fieldset1" >
<div class="formRow ">
<div class="labelContainer"><label class="rowLabel">label_if<span class="validationMark"></span></label></div>
<div class="rowControl">
<select id="xrule_1" name="Field" class="">
<option value="">Please Select</option>
<option value="2">Field on</option>
<option value="4">Field 2</option>
<option value="3">Field imported on</option>
</select>
</div>
</div> …
Run Code Online (Sandbox Code Playgroud)如标题所示,我需要创建一个正则表达式,该正则表达式必须$
与其匹配,并在其后跟随任何空格。例:
"asd $ 5" should match "$ ".
Run Code Online (Sandbox Code Playgroud)
有可能吗?我可以找到类似的东西。
我有一个我正在进行的项目,但它目前只支持.net framework 2.0.我喜欢linq,但由于框架版本我无法使用它.我想要的不仅仅是ORM方面的东西,而是Linq的"可查询性"(即使是一个词?).
到目前为止,最接近的是llblgen,但如果有更轻的重量可以让我查询更好.
我也看过NHibernate看起来它可以接近做我想要的,但它有一个非常陡峭的学习曲线,映射文件不会让我过于兴奋.
如果有人知道某些内容会给我一个类似Linq的查询接口(或者更好的是,如何让Linq在.net 2.0框架上工作)我真的很想听听它.
我怎样才能像这样垂直求和多维数组:
[
[1,2,3],
[4,5,6],
[7,8,9],
[2,4,6]
]
Run Code Online (Sandbox Code Playgroud)
要获得此结果:
[14, 19, 24]
Run Code Online (Sandbox Code Playgroud)
我为2个数组做了它,但我不知道如何为n
数组实现相同的解决方案.
这是我为2个阵列做的
var sum = array1.map(function (num, index) {
return num + array2[index];
});
Run Code Online (Sandbox Code Playgroud)
作为array1和array2,我想要求和的两个数组.那么我怎样才能为多维n
长度数组做同样的事情
简单的问题。javascript中是否存在类似php的东西??
?
在 php 中你可以这样做condition ?? statement2
这与 相同condition? condition : statement2
。
javascript中有类似的东西吗?
我需要从 JSON 格式获取数组中的最后一项。我有这个 JSON。
@json =
N'{
"solution": "xxxxxxxxxxxxxxxxxxxxx",
"options": [
{
"choice_id": 205073,
"choice": "aaaa"
},
{
"choice_id": 205074,
"choice": "bbbb"
},
{
"choice_id": 205075,
"choice": "cccc"
},
{
"choice_id": 205076,
"choice": "dddd"
}
],
}'
Run Code Online (Sandbox Code Playgroud)
我想得到
@json =
N'{
"solution": "xxxxxxxxxxxxxxxxxxxxx",
"options": {
"choice_id": 205076,
"choice": "dddd"
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能达到这个结果?
如何按升序排序数字数组,除了0(最后需要).例
[1,4,6,3,0,3,0,1] => [1,1,3,3,4,6,0,0]
Run Code Online (Sandbox Code Playgroud)
我试过arr.sort((a,b)=>a>b && a!=0)
但不行
我一直在寻找雄辩orWhere()
但在集合中具有相同功能。我只是发现我可以链接多个,where()
但是还没有找到类似的东西orWhere()
。
因此,基本上的问题是,有没有办法实现orWhere()
收藏中的类似东西?
我正在尝试获取一些数据,但我只是收到此错误
SQLSTATE[42000]:语法错误或访问冲突:1055 'ms_mascotas.ms_razas.id' 不在 GROUP BY 中(SQL:select
ms_razas.id
,ms_razas.nombre
,ms_mascotas.raza_id
,ms_mascotas.id
fromms_mascotas
inner joinms_razas
onms_razas.id
=ms_mascotas.raza_id
wherems_razas.tipo_animal_id
= 1 group byms_mascotas.raza_id
)”
我的查询是这样的
$data=Mascota::select("ms_razas.id","ms_razas.nombre","ms_mascotas.raza_id","ms_mascotas.id")
->join("ms_razas","ms_razas.id","=","ms_mascotas.raza_id")
->where("ms_razas.tipo_animal_id",$id)
->groupBy("ms_mascotas.raza_id")
->get();
Run Code Online (Sandbox Code Playgroud)
我一直在阅读这个错误,它与数据库文件中的严格模式有关,严格默认设置为false,我该怎么办?
我一直在寻找,但不幸的是找不到任何有用的东西。
我有一个功能
function myFunc ($param1, $param2){ ...
Run Code Online (Sandbox Code Playgroud)
我需要调用该函数,但是我在数组中有参数
$params = [$param1, $param2]
Run Code Online (Sandbox Code Playgroud)
有什么办法做类似...[]
(如在Js中)的事情吗?
注意:我做不到
myFunc($params[$param1], $params[$param2]);
Run Code Online (Sandbox Code Playgroud)