我在网上搜索过,主要使用 jquery 和一些库来执行此操作。我想知道如何使用纯javascript来制作像twitter一样的无限页面滚动效果,而无需包含任何库(这里我放了搜索php和html代码供参考,我想在搜索结果中实现效果。我使用 laravel 作为后端)。我刚刚开始学习 javascript,请把我当作一个 10 岁的男孩。谢谢
//HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Risky Jobs - Search</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="searchWrapper">
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method='get' >
<input type="search" name="search">
</form>
</div>
<h3>Risky Jobs - Search Results</h3>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
// PHP
function build_query($user_search, $sort){
$search_query = "SELECT * FROM posts";
$clean_search = str_replace(',',' ',$user_search);
$search_words = explode(' ', $clean_search);
//to become a array
$final_search_words = array();
if(count($search_words) > 0){
foreach($search_words as …Run Code Online (Sandbox Code Playgroud) 我以前使用基础5使用指南针来做sass的事情.但现在我切换到基础6,我总是做不到.当运行gulp时,它显示错误:
file to import not found or unreadable: util/util
Run Code Online (Sandbox Code Playgroud)
我在这里找到了一个答案:http://foundation.zurb.com/forum/posts/36389-what-is-import-utilutil,其中说基础6使用libsass,但我不知道libsass并且想要使用指南针因为我已经使用了commpass mixins并在我的项目中运行了类似功能.我尝试了他们说的方式,但没有成功.谁知道如何使用指南针使用基础6?顺便说一句,我使用命令行生成我需要的所有工具的基础项目,然后我使用基础5和grunt复制并粘贴我的旧项目到新的基础6文件夹.谢谢.
是否可以使用如下所示的语句来定义方法而不使用prototype?
Person.sayHello = function () {...}
Run Code Online (Sandbox Code Playgroud)
在这个例子中
var Person = function (firstName) {
this.firstName = firstName;
};
Person.prototype.sayHello = function() {
console.log("Hello, I'm " + this.firstName);
};
var person1 = new Person("Alice");
var person2 = new Person("Bob");
Run Code Online (Sandbox Code Playgroud)