我正在使用Infinite-scroll Jquery向下滚动网页。我正在使用引导程序进行设计。它非常适合普通的 html 代码。但是当我使用引导程序时。它没有显示任何引导组件。
当我将普通的 HTML 代码放在 temp.html 文件中时,它工作得很好。但是,当我将引导类及其代码插入 temp.html 无限滚动时,它不起作用。
这是我的 Handeller 代码
class Demo(webapp2.RequestHandler):
def get(self):
conn = get_connection()
data = conn.cursor()
data.execute("""
select * from table1
""")
alldata=data.fetchall()
conn.commit()
template=jinja_environment.get_template('demo.html')
template_values={
'alldata':alldata
}
self.response.out.write(template.render(template_values))
conn.close()
这是demo.html
<div id="content>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
{{alldata[0]}}
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
{{alldata[0]}}
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
</div>
</div>
<a id="next" href="#">next page?</a>
<script>
$('#content').infinitescroll({
navSelector : "#next:last",
nextSelector : "a#next:last",
itemSelector : "#content p",
debug : true,
dataType : 'html',
maxPage : 200,
path: function(index) {
return "/ScrollBarDemo/" + index
}
}, function(newElements, data, url){
});
</script>
这是滚动类
class ScrollBarDemo(BaseHandler):
def get(self,index):
template=jinja_environment.get_template('temp.html')
self.response.out.write(template.render()
temp.html [工作中]
<div id="content">
<p>
<input type="text">
</p>
</div>
temp.html [不工作]
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
</div>