我在外部 javascript 文件中定义了以下两个函数:
function show_sidebar_left(url, sb_width, sb_time){
$('#sidebar_left').css({'left':-sb_width, 'width': sb_width});
$('#sidebar_left').animate({"left":"0px"}, sb_time, function(){
$('#sidebar_left').load(url, function(){
alert("test");
});
$('#sidebar_left').addClass('sidebar_left_open');
});
$('#overlay').fadeIn(200);
}
function hide_sidebar_left(speed){
var sidebar_left_pos = parseInt($('#sidebar_left').css('width'),10) + 20;
$('#sidebar_left').html('');
if($('#sidebar_left').hasClass('sidebar_left_open')){
$('#sidebar_left').animate({"left":'-' + sidebar_left_pos + 'px'}, speed, function(){
$('#sidebar_left').removeClass();
});
$('#overlay').fadeOut(200);
}
}
它是一个滑动 div,我想用外部 php 文件的内容(仅包含一些 html 标签)填充它。我用以下方式调用文件:
$('#bars_tb_search').click(function(){
show_sidebar_left('http://www.zwoop.be/develop/home/bars/bars_toolbox/toolbox_search.php', 550, 300);
});
div 按预期正确滑动,以便正常工作。
Ajax 加载的回调函数中的“alert”被正确调用。
但是...我的 div 没有加载(我在 Google Chrome 的元素检查器中检查了它)。
控制台未指示有关此负载的 Javascript 错误。
任何想法我的问题可能是什么或我可能做错了什么?
编辑 在图片中,它显示了应用的 css 样式。
当我调整页面大小时,现在会发生这种情况:
这对你有意义吗?我正在失去信心:-s
编辑2
加载的页面不包含额外的 css,它是一个带有静态 html 的 php 页面:
<p style="text-align: center">
<i>
Note that these filters are applied on top of the results, already filtered by the search categories and tags.
</i>
</p>
<p style="text-align: center">
<i>
To filter on <b>all</b> bars, you can remove the previous filters here:
</i>
</p>