jQuery in IE6
jQuery in IE6
I'm having a big issue on some jQuery i've put together for a clients website.
The code seems to fall over in IE6 somewhere in this script, but i cant work out where.
If any of you lovely people could help, i'd grately appreciate it!!
- <script type="text/javascript">
var ImageContent = '<div id="ImageDiv"><div id="page1"
style="background:url(images/space.gif); width:400px;height:848px;background-position:400px;display:block;"></div><div id="page2" style="background:url(images/space.gif); width:400px; height:848px; background-position:800px; display:none;"></div></div>';
$(document).ready(function() {
//hide the real preview
$("#previewPlaceholder").hide();
//insert a new preview
$("#previewPlaceholder").after(ImageContent)
});
function pageChange(side, page) {
var pagePosition;
if(page == 1) { pagePosition = '400px' }
if(page == 2) { pagePosition = '800px' }
if(page == 3) { pagePosition = '0px' }
if(side == 'page1') {
var cssObj = { 'background-position' : pagePosition,
'display' : 'block'
}
$('#page1').css(cssObj);
$('#page2').css('display', 'none')
}
if(side == 'page2') {
var cssObj = {
'background-position' : pagePosition,
'display' : 'block'
}
$('#page2').css(cssObj);
$('#page1').css('display', 'none')
}
}
function StorefrontPostAjaxHook()
{
//find the real preview source and href and then set it to the new preview
var imgs,i;
$('#vcrControls').hide();
imgs = document.getElementsByTagName('img');
for(i=0;i<imgs.length;i++)
{
if (imgs[i].className == "formFillingPreview")
{
previewImage = imgs[i].src;
previewImage2 = previewImage.replace('Page=1','Page=2');
CurrentBGP = $('#page1').css('background-position');
CurrentBGP2 = $('#page2').css('background-position');
$('#page1').css('background', 'url('+previewImage+')');
$('#page2').css('background', 'url('+previewImage2+')');
$('#page1').css('background-position', ''+CurrentBGP+'');
$('#page2').css('background-position', ''+CurrentBGP2+'')
}
}
}
</script>