我是javascript的新手,我正在尝试创建一个水平滚动div: -
你可以看到菜单链接转到每种颜色,但我想把它放在一个250x250px的容器内,所以只有1种颜色可见,然后你点击任何一个链接,它滚动到那种颜色.
希望有人可以帮我指点几点.
谢谢!
jQuery(document).ready(function ($) {
$(".scroll").click(function (event) {
event.preventDefault();
$('html,body').animate({
scrollLeft: $(this.hash).offset().left
}, 200);
});
});Run Code Online (Sandbox Code Playgroud)
.container {
white-space: nowrap;
}
.child-element {
min-width: 250px;
display: inline-block;
height: 250px;
}
.child1 {
background-color: purple;
}
.child2 {
background-color: orange;
}
.child3 {
background-color: black;
}
.child4 {
background-color: green;
}
.child5 {
background-color: blue;
}
.child6 {
background-color: red;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<a href="#purple" class="scroll">PURPLE</a>
<a href="#orange" class="scroll">ORANGE</a>
<a href="#black" class="scroll">BLACK</a>
<a href="#green" class="scroll">GREEN</a>
<a href="#blue" …Run Code Online (Sandbox Code Playgroud)我想在投掷时在Laravel 5中显示404页面MethodNotAllowedHttpException.
谁可以在这方面帮助我?
我正在尝试构建非常简单的引导程序警报组件,但我无法弄清楚如何获取innerHTML我的自定义组件.
码:
Vue.component('my-alert', {
template: '#vue-alert',
props: ['type', 'title', 'message'],
created: function() {
this.message = this.innerHTML; // <---- NOT WORKING
}
});
var vm = new Vue({
el: 'body'
});
Run Code Online (Sandbox Code Playgroud)
HTML:
<my-alert type="success" title="Important">My Message here.</my-alert>
Run Code Online (Sandbox Code Playgroud)
我想显示组件中提供的任何文本,在这种情况下它应该显示 My Message here.
我想在条件中使用两个值搜索多维数组中的键.
我知道如何使用单个搜索条件搜索多维数组:
$key = array_search($journee, array_column($data,'journee'));
Run Code Online (Sandbox Code Playgroud)
但不仅仅是那个.这是我的阵列设置:
Array
(
[0] => Array
(
[pseudo] => titi
[journee] => 11
[pts] => 3
)
...
[10] => Array
(
[pseudo] => test
[journee] => 10
[pts] => 6
)
[11] => Array
(
[pseudo] => test
[journee] => 11
[pts] => 4
)
)
Run Code Online (Sandbox Code Playgroud)
如果我只11输入array_search和array_column输入密钥journee,它将返回0.
我也想添加pseudo搜索条件(键journee和pseudo应搜索特定值).
我怎么做到这一点?
在所有的PHP手册,它说null,true和false有内在价值。然而,无处没有说为什么他们可以用反斜杠写:\null,\false,\true。
究竟是什么null,false以及true在PHP?
一个常量,还是对翻译的帮助?
我试图从数据库中读出一个便士的值。
例如,如果我读出 1345 便士,这是 13.45 英镑。
始终在小数点前 2 位后加点的最佳方法是什么?
我想知道如何使用 Laravel 5.2 计算目录中的文件数量:
$folderPath="upload/";
$countFile=0;
$totalFiles=glob($folderPath."*");
if($totalFiles){
$countFile=count($totalFiles);
}
print_r($countFile);
Run Code Online (Sandbox Code Playgroud)
这对我不起作用。
嗨,我是使用甜蜜警报 js 使我的警报框更加花哨的新手。我正在使用普通的 javascript 警报确认来删除表中的特定数据。但是,当我尝试在删除之前运行甜蜜警报确认时,它会删除文件而不会弹出确认。
下面是我的 JS 中的代码。
<script>
archiveFunction() {
swal({
title: "Are you sure?",
text: "But you will still be able to retrieve this file.",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, archive it!",
cancelButtonText: "No, cancel please!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm){
if (isConfirm) {
swal("Deleted!", "Your imaginary file has been archived.", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是我下面的 html 表单。
<form action="<?php echo $_SERVER['PHP_SELF']; …Run Code Online (Sandbox Code Playgroud) 我的应用程序返回两行之间的相对位置,我想用Javascript绘制这些行.该线由导向矢量,点和三维定义.
有没有可以做到这一点的图书馆?我发现只有Victor.js,但对我的情况没有帮助