用于检查div类"media"是否在浏览器可视视口内,而不管窗口滚动位置如何.
<HTML>
<HEAD>
<TITLE>My first HTML document</TITLE>
</HEAD>
<BODY>
<div class="main">
<div class="media"></div>
</div>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)
尝试使用此插件https://github.com/customd/jquery-visible与此功能,但我不知道如何使其工作.
$('#element').visible( true );
Run Code Online (Sandbox Code Playgroud) 这是网址:
http://localhost/test.php?id=http://google.com/?var=234&key=234
Run Code Online (Sandbox Code Playgroud)
我无法获得完整的$ _GET ['id']或$ _REQUEST ['d'].
<?php
print_r($_REQUEST['id']);
//And this is the output http://google.com/?var=234
//the **&key=234** ain't show
?>
Run Code Online (Sandbox Code Playgroud) 我写了一个小聊天插件,我需要在我的网站上使用.它使用HTML中的简单结构,如下所示:
<div id="div_chat">
<ul id="ul_chat">
</ul>
</div>
<div id="div_inputchatline">
<input type="text" id="input_chatline" name="input_chatline" value="">
<span id="span_sendchatline">Send</span>
</div>
Run Code Online (Sandbox Code Playgroud)
当然,在Span元素上有一个'click'绑定事件.然后,当用户插入消息并单击"发送"span元素时,会出现一个Javascript函数,调用Ajax事件将消息插入MySQL数据库:
function function_write_newchatline()
{
var chatline = $('#input_chatline').val();
$.ajax
({
type: "POST",
url: "ajax-chat-writenewline.php", //1: ok, 0: errore
data: ({'chat_line': chatline}),
dataType: "text",
cache: false,
success: function(ajax_result)
{
function_get_newchatlines();
}
});
}
Run Code Online (Sandbox Code Playgroud)
并且,如果消息成功插入到DB中,它会调用一个函数来读取新行并将它们放入我之前发布的HTML结构中:
function function_get_newchatlines()
{
$.ajax
({
type: "POST",
url: "ajax-chat-loadnewlines.php", //1: ok, 0: errore
data: '',
dataType: "text",
cache: false,
success: function(ajax_result) //example of returned string: 'message1>+<message2>+<message3'
{
//explode new chat …Run Code Online (Sandbox Code Playgroud) 通常,我最终会做这样的事情:
<div class="one">
<div class="floating-two">content</div>
<div class="clear"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
我们通常的意思是,"确保任何浮动元素都包含在第一块中".可能是Sof,应用于"one"的任何背景都出现在所有内容之后,浮动或不浮动.
我正在寻找一种更清洁的方法来做到这一点.毕竟,"清晰"div只是我们打算应用于"一"的风格.我们可以这样做:
.floating-two:after{
clear:both;
}
Run Code Online (Sandbox Code Playgroud)
但这也不正确.浮动二不知道在"一"关闭之前是否可能有其他块跟随它.
有人为此开发了一个技巧吗?