Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.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 jQuery在结果中包含创建的子项_Javascript_Jquery_Html_Scroll - Fatal编程技术网

Javascript jQuery在结果中包含创建的子项

Javascript jQuery在结果中包含创建的子项,javascript,jquery,html,scroll,Javascript,Jquery,Html,Scroll,我将插入一个div,每n个子元素插入一个div,然后再插入一个div,调用父元素的子元素,但是jQuery插入的元素不在这个新列表中。我怎样才能得到插入的元素呢 对不起,如果这没有意义 这在代码中可能更容易实现,所以现在开始吧 jQuery(文档).ready(函数(){ 对齐多重网格(4,5,5,1); }); /** *对齐对象的栅格 * *@param cols网格中的列数 *@param cellWidth每个单元格的宽度 *@param cellHeight每个单元格的高度 *@pa

我将插入一个div,每n个子元素插入一个div,然后再插入一个div,调用父元素的子元素,但是jQuery插入的元素不在这个新列表中。我怎样才能得到插入的元素呢

对不起,如果这没有意义

这在代码中可能更容易实现,所以现在开始吧

jQuery(文档).ready(函数(){
对齐多重网格(4,5,5,1);
});
/**
*对齐对象的栅格
*
*@param cols网格中的列数
*@param cellWidth每个单元格的宽度
*@param cellHeight每个单元格的高度
*@param填充单元格之间的填充
*/
函数alignGrid(/*string*/id、/*int*/cols、/*int*/cellWidth、/*int*/cellHeight、/*int*/padding){
var x=0;
var y=0;
var计数=1;
jQuery(“#”+id).each(函数(){
jQuery(this).css(“位置”、“相对”);
jQuery(this).children(“div”).each(函数(){
jQuery(this).css(“width”,cellWidth+“em”);
jQuery(this).css(“height”,cellHeight+“em”);
jQuery(this).css(“位置”、“绝对”);
jQuery(this).css(“左”,x+“em”);
jQuery(this).css(“top”,y+“em”);
如果((计数%cols)==0){
x=0;
y+=单元高度+填充;
}否则{
x+=单元格宽度+填充;
}
计数++;
});
});
}
/* 
*处理动态多重网格的变量
*/
var-gridcount=0;
var网格宽度;
var网格高度;
var currentgrid=0;
/* 
*将栅格定位到特定栅格索引。
*/
函数位置网格(/*int*/gridpos){
jQuery(#gridnav“+currentgrid).removeClass(“gridnavitemselected”);
currentgrid=gridpos;
jQuery(“.multigrid”)。每个(函数(){
jQuery(this.animate)({
左:“-”+(网格宽度*当前网格)+“em”
}, 1500);
});
/*
*根据需要将下一个和上一个链接设置为可见
*/
如果(currentgrid==0){
jQuery(“#prevcontainer”).hide(0);
}否则{
jQuery(“#prevcontainer”).show(0);
}
如果(currentgrid==(gridcount-1)){
jQuery(“#nextcontainer”).hide(0);
}否则{
jQuery(“nextcontainer”).show(0);
}
jQuery(#gridnav“+currentgrid).addClass(“gridnavitemselected”);
返回false;
}
/* 
*转到下一个栅格位置。“向右移动”按钮
*/
函数positionGridNext(){
如果(currentgrid==(gridcount-1)){
返回false;
}
位置网格(当前网格+1);
返回false;
}
/* 
*转到上一个栅格位置。“向左移动”按钮
*/
函数positionGridPrev(){
如果(currentgrid==0){
返回false;
}
位置网格(当前网格-1);
返回false;
}
/* 
*将项目添加到网格导航栏
*/
函数addNavItem(索引){
jQuery(“#gridnav”).append(“”);
/*
*导航区域需要足够宽以容纳所有项目,以便我们
*根据子导航项目的数量动态设置其位置。
*/
jQuery(“#gridnavcontainer”).css(“right”),((jQuery(#gridnav”).children().length*3)+0.5)+em);
}
/**
*将跨多个页面的网格与的动态链接对齐
*页面之间的导航。
*
*@param cols网格中的列数
*@param cellWidth每个单元格的宽度
*@param cellHeight每个单元格的高度
*@param填充单元格之间的填充
*/
函数对齐多重网格(/*int*/cols、/*int*/cellWidth、/*int*/cellHeight、/*int*/padding){
var xoffset=填充;
var x=xoffset;
var y=填充;
var-cellcount=1;
var rowcount=1;
var maxrows=3;
网格宽度=(cols*(单元格宽度+填充))+填充;
网格高度=(最大行*(单元格高度+填充))+填充;
currentgrid=0;
变量n=$(“.cell”).length;
var c=(cols*maxrows);
如果(n>c){
jQuery(“.cell:nth child(+c+“n)”)。在(“NEXT”)之前;
}
/* 
*首先,我们将样式和导航组件添加到主网格容器中
*/
jQuery(“.maingridcontainer”).each(函数(){
jQuery(this).css(“位置”、“相对”);
jQuery(this).css(“width”,(gridwidth+5)+“em”);
jQuery(this).css(“height”,(gridheight+5)+“em”);
/* 
*现在我们将添加下一个和上一个链接
*/
jQuery(this.append(“)+
"" +
"");
jQuery(this.append(“)+
" < " +
"");
/* 
*现在是上一个和下一个链接样式
*/
jQuery(“#prevcontainer”)。每个(函数(){
jQuery(this).css(“宽度”,“4em”);
jQuery(this.css)(“高度”,“2em”);
jQuery(this).css(“位置”、“绝对”);
jQuery(this).css(“top”((maxrows/2)*(cellHeight+padding)-0.5)+“em”);
jQuery(this.css)(“left”,“0em”);
});
jQuery(“#nextcontainer”)。每个(函数(){
jQuery(this).css(“宽度”,“4em”);
jQuery(this.css)(“高度”,“2em”);
jQuery(this).css(“位置”、“绝对”);
jQuery(this).css(“top”((maxrows/2)*(cellHeight+padding)-0.5)+“em”);
jQuery(this.css)(“left”,(gridwidth+2)+“em”);
});
});
/* 
*现在我们设计网格容器本身并添加导航栏
*/
jQuery(“.multigridcontainer”).each(函数(){
jQuery(this.css)(“溢出”、“隐藏”);
jQuery(this).css(“位置”、“相对”);
jQuery(this.css)(“left”,“2em”);
jQuery(this).css(“width”,gridwidth+“em”);
jQuery(this).css(“height”,(gridheight+5)+“em”);
/* 
*添加网格导航栏
*/
jQuery(this).append(“”);
jQuery(“#gridnavcontainer”)。每个(函数(){
jQuery(this).css(“位置”、“绝对”);
jQuery(这个)