Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ubergallery和ajax_Javascript_Php_Jquery_Ajax - Fatal编程技术网

Javascript Ubergallery和ajax

Javascript Ubergallery和ajax,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,试图通过Ajax调用Ubergallery,我遇到了很多问题,我用下面的脚本解决了这些问题。 现在一切都可以正常工作了,除了一件事我没有导航按钮。你能帮我解决这个问题吗 您可以在页面上看到我用ajax调用的按钮 但当你称之为“菜单音乐”时,按钮不在那里 先谢谢你 $(document).ready(function(){ $(document).on("click", "a[rel='colorbox']", function(e){ e.preventDefau

试图通过Ajax调用Ubergallery,我遇到了很多问题,我用下面的脚本解决了这些问题。 现在一切都可以正常工作了,除了一件事我没有导航按钮。你能帮我解决这个问题吗

您可以在页面上看到我用ajax调用的按钮 但当你称之为“菜单音乐”时,按钮不在那里

先谢谢你

    $(document).ready(function(){
        $(document).on("click", "a[rel='colorbox']", function(e){
    e.preventDefault();
    var url = this.href;
    $.colorbox({href: url, maxWidth: "99%", maxHeight: "99%", opacity: ".5"});
    });
    });
我试图解决这个问题,我意识到 e、 防止违约(); 不允许读取库中的所有图像,并且单击的图像似乎是库中唯一的图像 我想这就是我没有导航按钮的原因。 有人能帮我查一下密码吗。如果我写的时候没有 e、 防止违约(); 不能正常工作。 多谢各位

在index.htm上,我使用此ajax代码调用gallery.php

<script>
function gallery(){
var xmlhttp;
// code for IE7+, Firefox, Chrome, Opera, Safari
if (window.XMLHttpRequest){
    xmlhttp=new XMLHttpRequest();
}
// code for IE6, IE5
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("myDiv").innerHTML =         xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET", "gallery.php", true);
    xmlhttp.send();
}
</script>

函数库(){
var-xmlhttp;
//IE7+、Firefox、Chrome、Opera、Safari的代码
if(window.XMLHttpRequest){
xmlhttp=新的XMLHttpRequest();
}
//IE6、IE5的代码
否则{
xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”);
}
xmlhttp.onreadystatechange=函数(){
if(xmlhttp.readyState==4&&xmlhttp.status==200){
document.getElementById(“myDiv”).innerHTML=xmlhttp.responseText;
}
}
open(“GET”,“gallery.php”,true);
xmlhttp.send();
}
php使用以下代码创建这些内容

<html>
<head>

 <link rel="shortcut icon" href="Gallery/resources/themes/uber-naked/images/favicon.png" />
 <link rel="stylesheet" type="text/css" href="Gallery/resources/themes/uber-naked/rebase-min.css" />
 <link rel="stylesheet" type="text/css" href="Gallery/resources/UberGallery.css" />
 <link rel="stylesheet" type="text/css" href="Gallery/resources/colorbox/5/colorbox.css" />
 <link rel="stylesheet" type="text/css" href="Gallery/resources/themes/uber-naked/style.css">

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script>
 <script type="text/javascript" src="Gallery/resources/colorbox/jquery.colorbox.js"></script>

 <script type="text/javascript">

 $(document).ready(function(){
 $("a[rel='colorbox']").colorbox({maxWidth: "90%", maxHeight: "90%", opacity: ".5"});
 });
 </script>

 </head>
 <body>


 <?php include_once('Gallery/resources/UberGallery.php'); $gallery = UberGallery::init()->createGallery('Gallery/gallery-images'); ?>

 </body>
 </html>

$(文档).ready(函数(){
$([a[rel='colorbox']).colorbox({maxWidth:“90%”,maxHeight:“90%”,不透明度:.5“});
});
当我打开gallery.php时,evrything是正常的,当我使用ajax脚本调用它时,我没有导航按钮。 您需要在index.htm中包含第一个脚本才能使用库
有谁能告诉我为什么这个东西会出现在index.html

没有元素
rel='colorbox'
最后我找到了一个解决方案,我用iframe称之为gallery.php

<iframe id="iframeResult" frameborder="0" src="gallery.php" scrolling="no" height="100%" width="100%"></iframe>

我使用iframe(music.html)和AJAX调用该页面

<script>
function Music()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","files/Music.html",true);
xmlhttp.send();
}
</script>

函数音乐()
{
var-xmlhttp;
if(window.XMLHttpRequest)
{//IE7+、Firefox、Chrome、Opera、Safari的代码
xmlhttp=新的XMLHttpRequest();
}
其他的
{//IE6、IE5的代码
xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”);
}
xmlhttp.onreadystatechange=函数()
{
if(xmlhttp.readyState==4&&xmlhttp.status==200)
{
document.getElementById(“myDiv”).innerHTML=xmlhttp.responseText;
}
}
open(“GET”,“files/Music.html”,true);
xmlhttp.send();
}

唯一的问题是照片的增长与iframe一样大

OP comments:
我不知道如何在不破坏此代码的情况下添加此元素
(注意:这是从答案的编辑内容中提取的)。如果你认为你可以帮助他,然后考虑加强你的答案。谢谢。是的,我在编辑历史中看到了这一点——我不知道有了这个代表就可以编辑答案了。你需要像在gallery.php中一样将这些锚添加到index.html中——检查html的源代码,在那里你可以看到。