调整图像的大小时, 他们使用的脚本会监听 recision
事件 。
$(window).resize(function() {
var top_target = #work +current_section;
var $main = $( #main );
$main.scrollTo(top_target);
var i=0;
for (i=0;i<=15;i++)
{
var $container = $( #work +i);
var left_target = #workcontent1 ;
$container.scrollTo(left_target);
}
var left_target = #workcontent +current_image;
var $work_container = $( #work +current_section);
$work_container.scrollTo(left_target);
// Get Window Size
var myWidth = 0, myHeight = 0;
myWidth = $(window).width();
myHeight = $(window).height();
if(myHeight >= 900){
image_height = 900;
image_width = 1350;
}
else{
image_height = myHeight;
image_width = image_height * 1.5;
}
// Set Image Offset
var $imgcont = $( .imgcontainer );
$imgcont.css( width , +image_width);
$imgcont.css( margin-top , +image_height / -2 + "px");
$imgcont.css( margin-left , +image_width / -2 + "px");
});