...

View Full Version : jQuery [JS] IE7/8 Clone/Append problem



Noury
09-01-2010, 10:19 AM
I've been struggling with a huge problem on IE7/8. I知 working within jQuery 1.2.6 (Drupal) and i知 using the .clone() function followed by multiple .append() functions.

I知 working on an image carousel where i知 copying several images five times. Those images have mouse (hover & click) events attached to them. When i clone and append them, it all works good in FF, Chrome & Safari.

Anyway, in IE there are 2 problems after those actions:

1.
I'm copying the imageslider 5 times and IE displays only the first one that is been copied. The other sliders are visible in the source code but not on screen. The overflow div has a fixed width which doesn稚 change in the correct value when using jQuery.

2.
The most important problem is that the .click() & .mouseover() events are not copied. In IE developer tools i see that the jQuery1232434 (any number possible) attribute is set to null in all the underlying children elements. (Yes, i've tried .clone(true))

I can稚 seem to find the problem anywhere :eek: so I don稚 know how to fix this. Below my source code for copying and appending:

if (width > 1280)

{

var newWidth;

//Copy content of scrolling div

var thumbImages = $("div").clone();



for (var i = 0; i < 4; i++)

{

var lefArrCount = 1;

thumbImages.children().each(function()

{

//Change left values from images

newWidth = width * (i + 1);

var cssLeft = leftArray[lefArrCount] + newWidth;

$(this).css("left", cssLeft+'px');

lefArrCount++;

});

lefArrCount = 1;



//Append code, IE fails on taken over handlers (also with .clone(true))

$("div").append(thumbImages[0].innerHTML);

}



//Edit total width (IE fails and sets the width to width * 2)

$('div').css("width", (newWidth + width));

}



//Add the srcolling functionality on the DIV.

$(function() {

$("div").smoothDivScroll({

scrollingSpeed: 12,

mouseDownSpeedBooster: 3

});

});

}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum