画面の幅-225pxを計算するスクリプトがありますが、画面が1100pxに達したときに、関数が単に幅全体を使用するように変更したいと思います。
これが私が使用しているコードです:
function slide_holder(){
$('#main').css({'width': (($(window).width()) - 225 )+'px'});
$('.flexslider-container').css({'height': (($(window).height()) - 85 )+'px', 'width': (($(window).width()) - 225 )+'px'});
$('.flexslider').css({'height': (($(window).height()) - 275 )+'px'});
$('#tS3').css({'height': (($(window).height()) - 200 )+'px'});
$('#foot').css({'width': (($(window).width()) - 325 )+'px'});
}
そして、これはそれが呼ばれる方法です:
$(document).ready(function() {
slide_holder();
$(window).bind('resize', slide_holder);
});
私はこのようにそれを試すことを考えていましたが、私は大きな失敗をしました:
$(window).bind("resize", resizeWindow);
function resizeWindow(e){
var newWindowWidth = $(window).width();
// If width width is below 600px, switch to the mobile stylesheet
if(newWindowWidth < 1100){
function slide_holder(){
$('#main').css({'width': (($(window).width()) - 0 )+'px'});
$('.flexslider-container').css({'height': (($(window).height()) - 85 )+'px', 'width': (($(window).width()) - 0 )+'px'});
$('.flexslider').css({'height': (($(window).height()) - 275 )+'px'});
$('#tS3').css({'height': (($(window).height()) - 200 )+'px'});
$('#foot').css({'width': (($(window).width()) - 105 )+'px'});
}
}
// Else if width is above 600px, switch to the large stylesheet
else if(newWindowWidth > 1100){
function slide_holder(){
$('#main').css({'width': (($(window).width()) - 225 )+'px'});
$('.flexslider-container').css({'height': (($(window).height()) - 85 )+'px', 'width': (($(window).width()) - 225 )+'px'});
$('.flexslider').css({'height': (($(window).height()) - 275 )+'px'});
$('#tS3').css({'height': (($(window).height()) - 200 )+'px'});
$('#foot').css({'width': (($(window).width()) - 325 )+'px'});
}
}
}