| snowysweb |
06-15-2009 04:30 AM |
jQuery script not work in any version of IE
Hi all was wondering if anyone could tell my why my script dont work in any version of IE.
http://www.actwebdesigns.co.uk/test
Code:
// JavaScript Document
//CREATED BY ACT WEB DESINGS//
//HTTP://WWW.ACTWEBDESIGNS.CO.UK//
$(document).ready(function(){
if($.cookie("width")==null){var width = 790;}else{var width = $.cookie("width");}
$('#plus').attr("href", "#"); //SET HREF ON PLUS ANCHOR, THIS MEANS THIS SCRIPT WILL ONLY WORK IF JAVASCRIPT IS ENABLED, ELSE WE WILL USE PHP SCRIPT
$('#neg').attr("href", "#"); //SET HREF ON NEG ANCHOR, THIS MEANS THIS SCRIPT WILL ONLY WORK IF JAVASCRIPT IS ENABLED, ELSE WE WILL USE PHP SCRIPT
$('#contrastChange').attr("href", "#");//SAME AS ABOVE BUT FOR CONTRAST
setWidth(width); //SET THE WIDTH RETRIEVED
setContrast($.cookie("contrast"));
$("#plus").bind("click", function increaseSize() { // IF CLICKED PLUS
if($.cookie("width")==null){var width = 790;}else{var width = $.cookie("width");}
if(width<1100)
{
var newWidth = Math.floor(Number(width) + Number(60));
$.cookie("width", + newWidth, { expires: 7 }); //SET COOKIE WITH NEW WIDTH
var newEm = (Number(newWidth)/1600);
$("body").animate({
fontSize: newEm + 'em'
}, 500, "easeInSine", function() {
//---------------------------------------------------------------------------//
$("#wrapper, #footer, #header, #top_bar, #main, #menu").animate({
width: newWidth + 'px'
}, 1000, "easeOutBounce" );
//---------------------------------------------------------------------------//
var mainColWidthWrapper = Math.floor(Number(newWidth) / 3);
$("#mainGreenWrapper, #mainBlueWrapper, #mainRedWrapper").animate({
width: mainColWidthWrapper + 'px'
}, 1000, "easeOutBounce" );
//---------------------------------------------------------------------------//
var mainColWidthFront = Math.floor(Number(mainColWidthWrapper)-24);
$("#mainGreenFront, #mainBlueFront, #mainRedFront").animate({
width: mainColWidthFront + 'px'
}, 1000, "easeOutBounce" );
//---------------------------------------------------------------------------//
}
);
}
});
$("#neg").bind("click", function decreaseSize() { // IF CLICKED NEG
if($.cookie("width")==null){var width = 790;}else{var width = $.cookie("width");}
if(width>790)
{
var newWidth = Math.floor(Number(width) - Number(60));
$.cookie("width", + newWidth, { expires: 7 }); //SET COOKIE WITH NEW WIDTH
var newEm = (Number(newWidth)/1600);
$("body").animate({
fontSize: newEm + 'em'
}, 500, "easeInSine", function() {
//---------------------------------------------------------------------------//
$("#wrapper, #footer, #header, #top_bar, #main, #menu").animate({
width: newWidth + 'px'
}, 1000, "easeInSine" );
//---------------------------------------------------------------------------//
var mainColWidthWrapper = Math.floor(Number(newWidth) / 3);
$("#mainGreenWrapper, #mainBlueWrapper, #mainRedWrapper").animate({
width: mainColWidthWrapper + 'px'
}, 1000, "easeInSine" );
//---------------------------------------------------------------------------//
var mainColWidthFront = Math.floor(Number(mainColWidthWrapper)-24);
$("#mainGreenFront, #mainBlueFront, #mainRedFront").animate({
width: mainColWidthFront + 'px'
}, 1000, "easeInSine" );
//---------------------------------------------------------------------------//
}
);
}
});
$("#contrastChange").bind("click", function increaseSize() { // IF CLICKED NEG
var contrast = $.cookie("contrast");
if(contrast == null || contrast == "no")
{
$.cookie("contrast", "yes", { expires: 7 });
setContrast("yes");
}
else
{
$.cookie("contrast", "no", { expires: 7 });
setContrast("no");
}
});
});
function setWidth(width){
$('#wrapper').css('width', width + 'px');
$('#footer').css('width', width + 'px');
$('#header').css('width', width + 'px');
$('#top_bar').css('width', width + 'px');
$('#main').css('width', width + 'px');
$('#menu').css('width', width + 'px');
var mainColWidthWrapper = Math.floor(Number(width) / 3);
$('#mainGreenWrapper').css('width', mainColWidthWrapper + 'px');
$('#mainBlueWrapper').css('width', mainColWidthWrapper + 'px');
$('#mainRedWrapper').css('width', mainColWidthWrapper + 'px');
var mainColWidthFront = Math.floor(Number(mainColWidthWrapper)-24);
$('#mainGreenFront').css('width', mainColWidthFront + 'px');
$('#mainBlueFront').css('width', mainColWidthFront + 'px');
$('#mainRedFront').css('width', mainColWidthFront + 'px');
var newEm = (Number(width)/1600);
$('body').css('font-size', newEm + 'em');
}
function setContrast(contrast) {
if(contrast == "yes")
{
//CSS WHEN CONTRAST IS TURNED ON
$('#top_bar p').css('color','#404040');
$('#top_bar').css('background-color','#F5F5F5');
$('#mainGreenFront').css('background','#F5F5F5');
$('#mainGreenLeftBorder').css('background','#F5F5F5');
$('#mainGreenRightBorder').css('background','#F5F5F5');
$('#mainBlueFront').css('background','#F5F5F5');
$('#mainBlueLeftBorder').css('background','#F5F5F5');
$('#mainBlueLeftBorder').css('border-left-color','#f18957');
$('#mainBlueLeftBorder').css('border-left-width','1px');
$('#mainBlueLeftBorder').css('border-left-style','solid');
$('#mainBlueRightBorder').css('background','#F5F5F5');
$('#mainRedFront').css('background','#F5F5F5');
$('#mainRedLeftBorder').css('background','#F5F5F5');
$('#mainRedRightBorder').css('background','#F5F5F5');
$('#mainRedLeftBorder').css('background','#F5F5F5');
$('#mainRedLeftBorder').css('border-left-color','#f18957');
$('#mainRedLeftBorder').css('border-left-width','1px');
$('#mainRedLeftBorder').css('border-left-style','solid');
$('#user_interface').css('background','url(images/for_web/interfaceReplacement.gif) no-repeat');
}
else
{
//CSS WHEN CONTRAST IS TURNED OFF
$('#top_bar p').css('color','#ffffff');
$('#top_bar').css('background-color','#456f81');
$('#mainGreenFront').css('background','url(images/for_web/main_box_front_green_middle.gif) top repeat-x');
$('#mainGreenLeftBorder').css('background','url(images/for_web/main_box_front_green_left.gif) left top no-repeat');
$('#mainGreenRightBorder').css('background','url(images/for_web/main_box_front_green_right.gif) right top no-repeat');
$('#mainBlueFront').css('background','url(images/for_web/main_box_front_blue_middle.gif) top repeat-x');
$('#mainBlueLeftBorder').css('background','url(images/for_web/main_box_front_blue_left.gif) left top no-repeat');
$('#mainBlueLeftBorder').css('border-left-color','none');
$('#mainBlueLeftBorder').css('border-left-width','none');
$('#mainBlueLeftBorder').css('border-left-style','none');
$('#mainBlueRightBorder').css('background','url(images/for_web/main_box_front_blue_right.gif) right top no-repeat');
$('#mainRedFront').css('background','url(images/for_web/main_box_front_red_middle.gif) top repeat-x');
$('#mainRedRightBorder').css('background','url(images/for_web/main_box_front_red_right.gif) right top no-repeat');
$('#mainRedLeftBorder').css('background','url(images/for_web/main_box_front_red_left.gif) left top no-repeat');
$('#mainRedLeftBorder').css('border-left-color','none');
$('#mainRedLeftBorder').css('border-left-width','none');
$('#mainRedLeftBorder').css('border-left-style','none');
$('#user_interface').css('background','url(images/for_web/interface_bar.gif) no-repeat');
}
}
click on the icons in the top right corner of the screen.
Regards
|