here javasript:
function random_imglink() { var myimages = [ {image: "/documents/templates/projedepo/banner/canon.jpg", url: "/index.cfm?fuseaction=objects2.detail_product&product_id=612&stock_id=612"}, {image: "/documents/templates/projedepo/banner/indigovision.jpg", url: "http://www.url2.com"} ]; var ry=math.floor(math.random()*myimages.length); var randomimage = myimages[ry]; var randomimagelink = '<a id="random_link" href="' + randomimage.url + '"><img style="z-index:1;position:absolute; left:70px; top:360px;" border="0" align="absmiddle" src="/documents/templates/projedepo/banner/daha_fazlasi.jpg" /></a><img id="random_img" src="'+randomimage.image+'" height="420" width="964" />'; document.getelementbyid("image2").innerhtml = randomimagelink; } $(function() { $(".image2").click(function() { var image = $(this).attr("rel"); var rel = $('#random_img').hide().fadein('slow').attr('src'); $('#random_img').attr('src', image); var randomlink = $(this).attr("href"); $('#random_link').attr('href',randomlink); var image2 = $('#random_img').attr('src'); $("#thumb2 img").removeclass("open"); $("#thumb2 a[rel='" + image2 + "'] img").addclass("open"); return false; }); }); $(document).ready(function() { var image2 = $('#random_img').attr('src'); $("#thumb2 a[rel='" + image2 + "'] img").addclass("open"); }); random_imglink()
here html:
<div id="slider_container"> <div id="image2">here written sript</div> <div id="thumb2"> <a href="/index.cfm?fuseaction=objects2.detail_product&product_id=612&stock_id=612" rel="/documents/templates/projedepo/banner/canon.jpg" class="image2" ><img title="canon" class="slider_thumb" src="/documents/templates/bilgiteknolojileri/images/t_flash/t1.png" border="0"/></a> <a href="http://www.url2.com" rel="/documents/templates/projedepo/banner/indigovision.jpg" class="image2"><img title="indigovision" class="slider_thumb" src="/documents/templates/bilgiteknolojileri/images/t_flash/t2.png" border="0"/></a> </div></div>
in internet explorer, not in firefox or opera, @ first works fine, random image displayed , thumbnails ok, when click thumbnail, random image turns in frame overflows, this: http://vteam.net.ru/_fr/11/1923928.jpg
the suspect thing see this:
$(document).ready(function() { var image2 = $('#random_img').attr('src'); $("#thumb2 a[rel='" + image2 + "'] img").addclass("open"); }); random_imglink()
in html-source wrote
<div id="image2">here written sript</div>
...so assume script placed there. can problem.replace code above with
$(document).ready(function() { var image2 = $('#random_img').attr('src'); $("#thumb2 a[rel='" + image2 + "'] img").addclass("open"); random_imglink(); });
(move call of random_imglink() ready-function). otherwise it's called immediately, there element manipulated (#image2) not closed yet, may result in error in msie.
Comments
Post a Comment