我有一个脚本,当它滚动时,使用jQuery和CSS在页面顶部定位一些东西.但是,滚动时条形图看起来很震动,并且已经固定在Google Chrome和Mozilla Firefox浏览器的顶部.为什么会这样?
我希望你能理解我想要描述的内容.如果没有,请将此代码与jQuery库一起复制并粘贴以查看我的意思:
<style type='text/css'>
body {
height:1000px;
margin:0;
padding:0;
}
#scroller {
position:relative;
top:60px;
width:100%;
background:#CCC;
height:20px;
}
</style>
<script type='text/javascript'>
$(window).load(function() {
$(window).scroll(function() {
if($(window).scrollTop()>60) {
$('#scroller').css('top', $(window).scrollTop());
}
});
});
</script>
<div id="scroller">Some controls</div>
Run Code Online (Sandbox Code Playgroud) 我想在Python中制作一个真正的脚本,它从指定网页的标题标签中获取内容,然后将它们放入MySQL数据库中.
我对Python的经验很少(而且我的意思是非常),但这需要为我的项目完成.我怎样才能以最简单的方式做到这一点?
我希望你能理解我想问的问题.
我有一个HTML错误页面,我希望重定向用户.例如; 如果用户收到错误页面,则会立即将其重定向到网页(http://www.domain.com/).
我怎么能用纯HTML而不做任何其他事情,所以它适用于所有浏览器?我应该使用什么标记?
我有PHP和HTML的代码,但我似乎无法让PHP代码回显到HTML.
<?php
countdown(2011,6,7,7,31,0);
function countdown($year, $month, $day, $hour, $minute){
$the_countdown_date=mktime($hour, $minute, 0, $month, $day, $year, -1);
$today=time();
$difference=$the_countdown_date - $today;
$days=floor($difference/60/60/24);
$hours=floor(($difference - $days*60*60*24)/60/60);
$minutes=floor(($difference - $days*60*60*24 - $hours*60*60)/60);
}
?>
<!doctype html>
<html>
<head>
</head>
<body>
<h1><?php echo "$days days $hours hours $minutes minutes";?></h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?提前致谢.
卡勒姆
我有一个半透明背景的导航栏,但导航链接也是半透明的.我该怎么做才能让我的链接变得透明?我在下面附上了我的代码副本(也可以在JSFiddle上找到.
<style type="text/css">
body{
margin:0;
padding:0;
}
a{
font-family:sans-serif;
font-size:15px;
}
#nav{
height:30px;
background-color:#dddddd;
filter:alpha(opacity=60);
opacity:0.6;
}
#right{
position:absolute;
top:0;
right:0;
}
.gbt{
display:inline-block;
line-height:26px;
}
.gbtc{
margin:0;
padding:0;
}
.gbts{
padding:6px;
}
</style>
<div id="nav">
<ol class=gbtc>
<li class=gbt><a href=""><span class=gbts>Link</span></a></li>
<li class=gbt><a href=""><span class=gbts>Link</span></a></li>
<li class=gbt><a href=""><span class=gbts>Link</span></a></li>
<li class=gbt><a href=""><span class=gbts>Link</span></a></li>
<li class=gbt><a href=""><span class=gbts>Link</span></a></li>
</ol>
</div>
Run Code Online (Sandbox Code Playgroud)
任何想法都非常感谢,我希望你能理解我想要描述的内容.我提供的代码更容易看到背景图像.
在此先感谢Callum
我的网站上有一个搜索引擎,SERP的URL是search/QUERY/1/.
如何制作HTML搜索框以填写QUERY我的网址部分?
它不能真正使用PHP但它可以使用javascript,如果它必须.
我有以下代码,使用JavaScript在页面加载时选择文本框.我在下面附上了我的代码副本.我的问题是如何在jQuery中完成?
<!doctype html>
<html>
<head>
</head>
<body>
<input id="query">
<script type="text/javascript">
function box(query){
document.getElementById('query').focus();
}
box('query');
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在此先感谢Callum
我有一个PHP搜索脚本,通过HTML来解析结果的样式.当其中一个结果悬停在它上面时,会突出显示为蓝色.结果显示在里面,使用边界半径给它弯曲的边缘.但是,当您将鼠标悬停在曲线所在框的顶部或底部的结果上时,蓝色会溢出曲线.我该如何解决这个问题?
我的HTML是:
<a href='{$row['url']}' class='result'>
<div class='title'>{$row['title']}</div>
<div class='url'>{$row['url']}</div>
<div class='desc'>{$row['description']}</div>
</a>
Run Code Online (Sandbox Code Playgroud)
我的CSS是:
#results{
background:#fff;
filter:alpha(opacity=80);
opacity:0.8;
color:#000;
width:75%;
float:left;
border-radius:0 10px 10px 10px
}
.result{
font:12px Verdana,Arial,Helvetica,sans-serif;
display:block;
padding:7px
}
.result:hover{
background-color:#d5e2ff
}
Run Code Online (Sandbox Code Playgroud) 我想从源代码中隐藏一段Javascript.我想到的方法是使用PHP包含脚本文件,但这似乎没有用.
有人对我有什么建议吗?如果您需要我的脚本副本,请询问.
在此先感谢Callum
我有一个PHP搜索建议脚本,它从MySQL数据库获取结果,然后使用jQuery将它们推送到页面.在我的数据库中,我有一个每个结果排名的字段,但我想在我的PHP代码中使这个工作.我希望排名字段中数字最高的结果显示得更高.
我的PHP代码是:
<p id="searchresults"><?php
$db=new mysqli('localhost','username','password','database');
if(isset($_POST['queryString'])){
$queryString=$db->real_escape_string($_POST['queryString']);
if(strlen($queryString)>0){
$query = $db->query("SELECT * FROM search WHERE name LIKE '%" . $queryString . "%' LIMIT 10");
if($query){
while ($result = $query ->fetch_object()){
echo '<a href="/search/'.$result->name.'/1/">';
$name=$result->name;
echo ''.$name.'';
}
}
}
}
?></p>
Run Code Online (Sandbox Code Playgroud)
我希望你能理解我想要描述的内容.
在此先感谢Callum