Javascript 通过菜单导航时的Jquery图像加载问题
我在尝试通过导航浏览网站时遇到以下问题 正如你们所看到的,左手边的站点图片有时加载,有时不加载, 我正在使用下面的代码在进入不同页面时更改图像Javascript 通过菜单导航时的Jquery图像加载问题,javascript,jquery,css,Javascript,Jquery,Css,我在尝试通过导航浏览网站时遇到以下问题 正如你们所看到的,左手边的站点图片有时加载,有时不加载, 我正在使用下面的代码在进入不同页面时更改图像 var pic = new Image(); pic.src = "images/homeLargeImg.jpg"; 下面是我的后端代码 变量RHigh=$“右窗格”。高度 var windhight=$window.height $pic.hide.loadfunction { //调试器; $this.fadeIn; var marginT=风高
var pic = new Image();
pic.src = "images/homeLargeImg.jpg";
下面是我的后端代码
变量RHigh=$“右窗格”。高度
var windhight=$window.height
$pic.hide.loadfunction
{
//调试器;
$this.fadeIn;
var marginT=风高/100*5
var imgH=边际+风高
$("#LeftPaneImage").html("<img id='triquibackimg' src='"+pic.src+"' style='"+windHigh+"'/>")
$("#LeftPane").css("width",$("#LeftPaneImage").width());
$("#RightPane").css("margin-left",$("#LeftPaneImage").width()+10);
resize()
}
$window.bind'resize',函数
{
调整大小
};
函数调整大小
{
//$RightPane.cssposposition,'relative';
// }
//else{$RightPane.cssmargin top,60}
}
}
有人能给我一些建议吗
谢谢主题外:我想对这个问题发表评论,因为我还没有答案,我必须重复50次才能发表评论,这太糟糕了 本体论: 你想达到什么目标?问题是什么 当我试图查看你的网站时,左边所有的大图片都在加载mac、chrome,我检查了所有页面。。 它们的装载速度确实很慢。。 为什么要通过javascript而不是简单地通过img标记插入图像?
事实上,我想调整左边图像的浏览器高度,当我调整窗口图像的大小根据窗口高度调整。右窗格和导航也会按照这个方向移动,而且右窗格必须和窗口对齐。我直到现在才注意到你们的评论,是否还需要回复?
RHigh=$('#RightPane').height()
windHigh=$(window).height()
if( RHigh < windHigh)
{
$("#triquibackimg").css("height",$(window).height());
$("#LeftPane").css("width",$("#LeftPaneImage").width());
$("#RightPane").css("margin-left",$("#LeftPaneImage").width());
//----------------Right Pane vAlign--------------
(function ($) {
$.fn.vAlign = function() {
return this.each(function(i){
var h = $(this).height();
var oh = $(this).outerHeight();
var mt = (h + (oh - h)) / 2;
$(this).css("margin-top", "-" + mt + "px");
$(this).css("top", "50%");
$(this).css("position", "absolute");
});
};
})(jQuery);
(function ($) {
$.fn.hAlign = function() {
return this.each(function(i){
var w = $(this).width();
var ow = $(this).outerWidth();
var ml = (w + (ow - w)) / 2;
$(this).css("margin-left", "-" + ml + "px");
$(this).css("left", $("#LeftPane").width());
$(this).css("position", "absolute");
});
};
})(jQuery);
$(document).ready(function() {
$("#RightPane").vAlign();
//$("#RightPane").hAlign();
});
}
else
{
$("#triquibackimg").css("height",(RHigh+150));
$("#LeftPane").css("width",$("#LeftPaneImage").width());
$("#RightPane").css("margin-left",$("#LeftPaneImage").width());
// if ($(window).height()>800){