在我的 web 应用程序中,我在网页顶部的固定工具栏中有一个搜索框。我像这样实现了工具栏的固定位置....
#toolbar {
position: fixed !important;
position: absolute;
height: 25px;
width: 100%;
top: 0px;
left: 0px;
margin: 0;
z-index: 100;
font-size: 12px;
}
Run Code Online (Sandbox Code Playgroud)
现在,我正在使用jQuery 插件在其上实现关键字自动完成功能。
我的问题是如何在滚动/调整窗口大小时将自动完成建议固定/附加到搜索框。
自动完成建议框的 css 是....
element.style {
display:none;
left:166px;
position:absolute;
top:96px;
width:130px;
}
.ac_results {
background-color:white;
border:1px solid #C5DBEC;
overflow:hidden;
padding:0;
z-index:99999;
}
Run Code Online (Sandbox Code Playgroud)
我在执行这些操作时遇到了问题..
我能做些什么来解决这个错误?
这是它的外观。

自动完成已在固定位置的输入框上滚动。
更新1:我尝试添加position: fixed;到自动完成。
这在不同的情况下会产生问题。
更新:

更新2:
添加到自动完成 css 的以下代码可以解决问题。
.ac_results {
background-color:white;
border:1px …Run Code Online (Sandbox Code Playgroud) 我有一个这样的查询,我想以分页格式显示排序的记录。
这是我的查询。
SELECT * FROM answers
WHERE userid = '10'
ORDER BY votes LIMIT 10, 20
Run Code Online (Sandbox Code Playgroud)
to 的两个参数LIMIT将用于生成记录的逐页显示。现在,我的问题是ORDER BY。MySQL 如何执行这个查询?
第一种方式
第二种方式
如果我像 MySQL 引擎一样思考,我想实现第二个,因为我将不得不对较少的记录进行排序?
有人可以对此有所了解吗?
问候
正如标题所说,我想根据指定容器的宽度和高度截断用户输入的文本字符串.我的规范是截断字符串,Read More在最后显示一些消息,当用户点击它时,文本向下滑动.
更新:啊!忘了一件事.它也应该处理多字节字符.
有人可以说明我有什么选择吗?jQuery插件还是一些漂亮的jquery片段?
感谢致敬
我必须创建一个mysql查询来获得超过特定日期的每一天的投票分配,类似这样......
date yes_votes no_votes
------------------------------------------
2010-01-07 21 22
2010-01-07 2 0
Run Code Online (Sandbox Code Playgroud)
我的桌子就像这样..
post_votes
--------------------------
id(longint)
date(timestamp)
flag(tinyint) // this stores the yes/no votes 1-yes, 2-no
Run Code Online (Sandbox Code Playgroud)
我被困在这....
SELECT COUNT(*) AS count, DATE(date) FROM post_votes WHERE date > '2010-07-01' GROUP BY DATE(date)
Run Code Online (Sandbox Code Playgroud)
这给出了每天的总投票数,但不是我想要的分配数.
我有一个webapp,它使用php服务器和数据库服务器执行很多ajax请求.我还创建了一个iPhone应用程序和一个Android应用程序,它们一直作为离线应用程序工作至今.
现在我想创建一个API,用于在Web服务器和智能手机应用程序之间同步数据.我应该使用OAuth吗?我读到的有关OAuth的内容 - 如果我想打开我的API以供第三方应用程序使用,它似乎已被使用.但在这里,我只想确保API和我自己的应用程序之间的数据安全传输.
有人可以对此有所了解吗?
所以我开始在XCode 4.3.2中使用故事板.我开始使用Master-Detail应用程序(iPad的拆分视图应用程序).在详细视图(命名DetailVC)中,我有一个视图,其中显示了一组自定义视图.
自定义视图(命名GridView)具有轻击手势识别器,该手势识别器应该处理每个自定义视图上的点击事件.点击GridView推动视图控制器会显示一些搜索结果(已命名SearchResultsVC).
通过GridView在单独的nib文件中创建,DetailVC并且SearchResultsVC驻留在故事板中,如何创建具有目标的推送segue SearchResultsVC?我刚刚在DetailVC和SearchResultsVC之间创建了一个segue?有什么事情我可以在识别轻敲手势时从GridView类内部以编程方式触发此segue ????
好的,这就是我想要做的......
我想在服务器上实现Google事件的获取,以便我可以围绕它们构建其他功能,例如发送远程推送通知.
我被困在获取身份验证令牌并将其保存在服务器上并使用它从Google的日历api中获取事件,但无法找到相同的资源.有人可以对此有所了解.
UPDATE
我已经能够成功实施该方案直到第3步.
我从Google获取身份验证令牌和刷新令牌并将其保存在数据库中.现在使用Google API php客户端,我正在尝试使用我之前获得的访问令牌连接到Google的日历API.我使用以下代码...
require_once(APPPATH . "libraries/Google/Google_Client.php");
require_once(APPPATH . "libraries/Google/contrib/Google_CalendarService.php");
$client = new Google_Client();
$client->setAccessToken($google_access_token);
$calendar = new Google_CalendarService($client);
$calendarList = $calendar->calendarList->listCalendarList();
echo print_r($calendarList, true);
Run Code Online (Sandbox Code Playgroud)
但现在我收到了这个错误......
PHP致命错误:未捕获的异常'Google_AuthException',并在/myserver/application/libraries/Google/auth/Google_OAuth2.php:162中显示消息'无法json解码令牌'
堆栈跟踪:/myserver/application/libraries/Google/Google_Client.php(170):Google_OAuth2-> setAccessToken('a_token ...')
我了解到,我直接尝试在Google客户端api中设置访问令牌,而不指定任何重定向网址或用户授权访问服务器本身上的Google日历时通常使用的其他参数.这应该像我想的那样工作吗?
更新2
进一步挖掘后,我发现直接设置访问令牌setAccessToken不起作用,因为API的Google客户端需要在setAccessToken方法中使用JSON编码的字符串.经过一些调整后,我将代码更改为以下....
require_once(APPPATH . "libraries/Google/Google_Client.php");
require_once(APPPATH . "libraries/Google/contrib/Google_CalendarService.php");
$client = new Google_Client();
$client->setAccessType('offline');
$client->refreshToken($google_refresh_token);
$newToken = $client->getAccessToken();
$client->setAccessToken($newToken);
$calendar = new Google_CalendarService($client);
$calendarList = $calendar->calendarList->listCalendarList();
echo print_r($calendarList, true);
Run Code Online (Sandbox Code Playgroud)
现在我得到的错误是一个invalid_request.
刷新OAuth2令牌时出错,消息:'{"error":"invalid_request"}'
我想为Google Calendar API设置推送通知,只要Google日历api上的特定资源发生更改,我就会通知我的服务器.我想使用适用于PHP的Google API客户端库来执行此操作.
但似乎他们没有办法在PHP库中观看谷歌日历资源.可能是其他图书馆有一个watch方法,但我不太确定.
基本上,为特定资源设置推送通知,您必须将发布请求发送到这样的URL ...
POST https://www.googleapis.com/calendar/v3/calendars/my_calendar@gmail.com/events/watch
Authorization: Bearer auth_token_for_current_user
Content-Type: application/json
{
"id": "01234567-89ab-cdef-0123456789ab", // Your channel ID.
"type": "web_hook",
"address": "https://mydomain.com/notifications" // Your receiving URL.
}
Run Code Online (Sandbox Code Playgroud)
我可以在PHP中使用curl轻松地做到这一点,但我的问题是请求未经Google OAuth令牌授权,因此会导致错误.
我想知道这个问题是否有解决方法....
UPDATE
我试图将连接发送到Google而不添加正确的标头,因此我收到授权错误.纠正了那个部分后,我仍然遇到Invalid Credentials错误.这是我的代码片段的样子......
$url = sprintf("https://www.googleapis.com/calendar/v3/calendars/%s/events/watch", $calendar);
/* setup the POST parameters */
$fields = array(
'id' => "some_unique_key",
'type' => "web_hook",
'address' => sprintf("http://%s//event_status/update_google_events", $_SERVER['SERVER_NAME'])
);
/* convert the POST parameters to …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个搜索输入框,在聚焦时向左扩展,就像谷歌的移动网站一样.我试图只使用css这样做.
未在Safari(mac/iOS)中聚焦时的搜索框.左边的白色空间是公司徽标.请注意,输入文本框和搜索按钮之间没有空格.输入框有position:absolute, left:120px, right:80px.

焦点时的搜索框.我将left输入框更改为0开input:focus.

没有关注Firefox的搜索框.冲突的绝对位置值会left:120px, right:80px导致Chrome/Firefox上的输入文本框和按钮之间出现空白.

我该怎么做才能使用css创建这样一个左扩展输入框,而不指定常量值width.
这是代码......
header {
padding: 0;
}
input[type='text'] {
left: 120px;
position: absolute;
right: 77px;
top: 0;
transition-duration: 100ms;
}
input[type='text']:focus {
left: 0;
transition-duration: 300ms;
}
input[type='submit'] {
background: #1352ec;
color: #fff;
position: absolute;
right: 0;
top: 0;
width: 80px;
}Run Code Online (Sandbox Code Playgroud)
<header>
<form method="get" action="/search">
<input class="clearable" type="text" value="ipad"/>
<input type="submit" value="Search"/>
</form> …Run Code Online (Sandbox Code Playgroud)我正在尝试通过使用PHP GD合并图像来动态生成图像.我想知道是否有一种方法可以在我的网页中显示图像,而无需将其存储在服务器上的某个位置.
例如,我创建了以下用于合并图像的代码...
function create_image() {
$main_image = imagecreatefrompng("images/main.png");
$other_image = imagecreatefrompng("images/other.png");
imagecopy($main_image, $other_image, 114, 53, 0, 0, 49, 34);
imagepng($main_image);
imagedestroy($other_image);
}
Run Code Online (Sandbox Code Playgroud)
现在我的HTML代码到现在为止......
<div class="sidebar-avatar">
<img src="avatar_pattern.png" class="pattern1" width="430" height="100" />
</div>
Run Code Online (Sandbox Code Playgroud)
我应该如何调用php函数,以便它显示在我为其指定的div中生成的图像.
更新:我发现使用Content-type: image/png但这意味着我必须在单独的页面上显示图像而不是内联.