基本上我有一个文本框,我将输入URL并单击"确定按钮",它将在页面左侧显示HTML的预览; 并且右侧将具有HTML标记(正文,标题,div,span等)的树视图,在HTML中用作附加图像.预期的JSON结果应该是这个问题的结尾.我无法遍历JSON并创建树.我尝试了以下方法:
HTML和JS代码:
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ABC</title>
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
<div id="wrapper">
<header>
<h1 class="logo"><img src="images/logo.png" alt="" title="" /></h1>
</header>
<div id="container">
<div class="search-box">
<input type="text" id="url" value="" class="txt-box" />
<input type="button" value="OK" class="btn-search" />
</div>
<div class="inner-wrap">
<div class="left-wrap" id="preview-sec">
</div>
<div class="right-wrap" id="tree-sec">
</div>
</div>
</div>
</div>
<script type="text/javascript" language="javascript" src="js/jquery-1.11.1.js"></script><!-- Jquery plugin -->
<script>
var counter = 0;
$(document).ready(function(){
$('.btn-search').click(function(){
if ($('#url').val() != '') {
$.get(
'http://localhost/test/getHTML.php', {url:$('#url').val()}, …Run Code Online (Sandbox Code Playgroud) Google plus 登录在桌面浏览器上运行良好,但在移动浏览器上运行不正常。网站
链接
var client_id = gmail_client_id;
var scope = gmail_scope;
var apiKey = google_api_key;
function handleClientLoad() {
gapi.client.setApiKey(apiKey);
window.setTimeout(checkAuth,1);
}
function checkAuth() {
gapi.auth.authorize({client_id: client_id, scope: scope, immediate: true}, handleAuthResult);
}
function handleAuthResult(authResult) {
if (authResult && !authResult.error) {
access_token = authResult.access_token;
makeApiCall();
} else {
handleAuthClick();
}
}
function handleAuthClick(event) {
gapi.auth.authorize({client_id: client_id, scope: scope, immediate: false}, handleAuthResult);
return false;
}
function makeApiCall() {
gapi.client.load('oauth2', 'v2', function() {
var request = gapi.client.oauth2.userinfo.get();
request.execute(function(resp) {
checkGoogleUserExist(resp);
}); …Run Code Online (Sandbox Code Playgroud) 我有很多图像通过ajax加载.我正在使用砌体和延迟加载插件来显示图像.通过一个ajax调用加载所有图像导致问题和页面卡住直到所有图像得到排列,所以我在第一个ajax加载20个图像在这个逐个ajax请求之后,在每个呼叫中获得10个图像并通过砌体附加追加,然后立即呼叫.
function getMorePhotos () {
$.ajax({
type : "POST",
url : site_url+'controller/ajax_get_photos',
data : ,
complete: function(response)
{
if (response.responseText != '0' )
{
getMorePhotos();
}
},
success : function(response)
{
if (response == '0' || response == '') {
} else {
var temp = $(response).get();
temp.forEach(function( element, index ) {
$item = $(element);
$('#allPhoto1').find('ul.ins-view').append($item).masonry( 'appended', $item );
$item.find("img.lazy").lazyload({
effect : "fadeIn",
threshold : 100
});
});
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
这是第一次请求完成后的方法调用.
现在问题是:第一个图像连续闪烁,直到最后一个ajax请求完成.
我觉得这不是一个好的解决方案.任何人都可以建议吗?

我有<ul> <li>四列结构.(见图)