在一页上运行多个幻灯片

时间:2016-08-22 03:51:56

标签: javascript slideshow settimeout setinterval

我想使用javascript运行多个幻灯片,但未能使用setTimeout或serInterval执行此操作。

是否可以为多个幻灯片放映多个setTimeout或setInterval

我改变幻灯片的功能

myIndex = {};
timeoutHandles = {};

function Start_Slide_With_ID(id)
{

if( myIndex["index_"+id] == undefined || myIndex["index_"+id] == "" )
{
    myIndex["index_"+id] = 0;
}

myIndex["index_"+id] = myIndex["index_"+id]+1; 

data = Get_User_Element(id);

slider_data = data.slider_data;

slide_time = parseFloat(slider_data.slide_time);

// alert(slide_time)

total_slides = 0;

$("#element_"+id).find(".slide_data").each(function()
{

  total_slides++;

})

if( myIndex["index_"+id] > total_slides )
{
    myIndex["index_"+id] = 1;
}

ShowSlider(id,myIndex["index_"+id]);

slide_time = slide_time*1000;


if( timeoutHandles[id] == undefined || timeoutHandles[id] == "" )
{}
else
{
    clearTimeout(timeoutHandles[id])
}

timeoutHandles[id] =  setTimeout(function(){

    Start_Slide_With_ID(id);

},slide_time);


}

0 个答案:

没有答案