为了账号安全,请及时绑定邮箱和手机立即绑定

点击播放下一组图片的时候是空白,没有图片,但是也没有报错,是什么问题

/*
* @Author: Administrator
* @Date:   2017-08-23 14:58:45
* @Last Modified by:   Administrator
* @Last Modified time: 2017-08-23 17:43:51
*/

// JavaScript Document

var loopPlayInit=(function(){
    var $butLeft = null,
        $butRight = null,
        $butPlay = null,
        $imglist = null,   //定义null,保护
        origin=['135px','500px'],
        imgOrigin=['125px','800px'],
        imgAll = createImg([
                         ['images/1.jpg','images/2.jpg','images/3.jpg','images/4.jpg'],
             ['images/5.jpg','images/6.jpg','images/7.jpg','images/8.jpg'],
             ['images/9.jpg','images/10.jpg','images/11.jpg','images/12.jpg']
             ]),
        imgArrIndex = 0,
        imgAng = 45,
        imgTime = 300,
        rotating = false,    //控制当前动画的动画状态
        autoTimer = null,         //定时器
        autointerval = 1000;      //定时器间隔时间

        

    function init(){
        $butLeft = $(".butLeft");
        $butRight = $(".butRight");
        $butPlay = $(".butPlay");
        $imglist = $(".mainbox ul li");

        
        configer();    //调用configer函数
        setEvent();

    }

    function configer(){
        var ang = 4,
        aint = -4;
        $imglist.transform({origin:origin});
        $imglist.each(function(i){
            var $this = $(this);   //this是循环遍历出来的每一个当前元素
            $this.transform({rotate:aint+(i*ang)+"deg"});

        }) 

    }

    

    

    function setEvent(){
        $butLeft.bind("click",function(){
            anigo(-1);
            return false;   //返回空,不跳转

        });

        $butRight.bind("click",function(){
            anigo(1);
            return false;

        });

        $butPlay.bind("click",function(){
            var play = "play",
                pause = "pause",
                $but = $(this);

            if($but.text() == "play")
            {
                $but.text(pause);
                autoGo();

            }else{
                $but.text(play);
                autoShop();

            }

            return false;

        });

        

    }

    

    function createImg(arr){
        var imgArr = [];
        for(var i in arr){
            imgArr[i] = [];
            for(var x in arr[i]){
                imgArr[i][x] = new Image();   //将数组索引转化为图片对象
                imgArr[i][x].src = arr[i][x];

            }

        }

        return imgArr;

    }

    

    function anigo(d){
        if(rotating) return false;    //return直接跳出函数
        rotating = true;    //true:动画在执行

        imgArrIndex += d;
        console.log(imgAll.length);

        

        if(imgArrIndex > imgAll.length-1){
            imgArrIndex = 0;

        }

        else if(imgArrIndex < 0){
            imgArrIndex = imgAll.length-1;

        }  

        

        $imglist.each(function(i){
            var $thisItme = $(this);
            var $thisimg = $thisItme.children("img");   //当前存在的图片
            var $targetImg = $(imgAll[imgArrIndex][i]);   //新的图片
            var thisTime = (d===1)?imgTime*i:imgTime*($imglist.length-1-i);

            $thisItme.append($targetImg);
            $thisimg.transform({origin:imgOrigin});
            $targetImg.transform({origin:imgOrigin,rotate:(0-d)*imgAng+"deg"});
            setTimeout(function(){
                $thisimg.animate({rotate:imgAng*d + "deg"});
                $targetImg.animate({rotate:"0deg"},500,function(){
                    $thisimg.remove();
                    if(thisTime == ($imglist.length-1)*imgTime){
                        rotating = false;}

                });

            },thisTime);      //延时操作
 
        })

    }

    

    function autoGo(){
        clearInterval(autoTimer);
        anigo(1);
        autoTimer = setInterval(function(){
            anigo(1);

        },autointerval);

    }

    

    function autoShop(){

        clearInterval(autoTimer);   //清除定时器

    }

    

    

    return init;

})();   //追加括号,表示调用

 

loopPlayInit();

正在回答

2 回答


【蜘蛛侠TG@abin789】-1801
【蜘蛛侠TG@abin789】-1802
【蜘蛛侠TG@abin789】-1803
【蜘蛛侠TG@abin789】-1804
【蜘蛛侠TG@abin789】-1805
【蜘蛛侠TG@abin789】-1806
【蜘蛛侠TG@abin789】-1807
【蜘蛛侠TG@abin789】-1808
【蜘蛛侠TG@abin789】-1809
【蜘蛛侠TG@abin789】-1810
【蜘蛛侠TG@abin789】-1811
【蜘蛛侠TG@abin789】-1812
【蜘蛛侠TG@abin789】-1813
【蜘蛛侠TG@abin789】-1814
【蜘蛛侠TG@abin789】-1815
【蜘蛛侠TG@abin789】-1816
【蜘蛛侠TG@abin789】-1817
【蜘蛛侠TG@abin789】-1818
【蜘蛛侠TG@abin789】-1819
【蜘蛛侠TG@abin789】-1820
【蜘蛛侠TG@abin789】-1821
【蜘蛛侠TG@abin789】-1822
【蜘蛛侠TG@abin789】-1823
【蜘蛛侠TG@abin789】-1824
【蜘蛛侠TG@abin789】-1825
【蜘蛛侠TG@abin789】-1826
【蜘蛛侠TG@abin789】-1827
【蜘蛛侠TG@abin789】-1828
【蜘蛛侠TG@abin789】-1829
【蜘蛛侠TG@abin789】-1830
【蜘蛛侠TG@abin789】-1831
【蜘蛛侠TG@abin789】-1832
【蜘蛛侠TG@abin789】-1833
【蜘蛛侠TG@abin789】-1834
【蜘蛛侠TG@abin789】-1835
【蜘蛛侠TG@abin789】-1836
【蜘蛛侠TG@abin789】-1837
【蜘蛛侠TG@abin789】-1838
【蜘蛛侠TG@abin789】-1839
【蜘蛛侠TG@abin789】-1840
【蜘蛛侠TG@abin789】-1841
【蜘蛛侠TG@abin789】-1842
【蜘蛛侠TG@abin789】-1843
【蜘蛛侠TG@abin789】-1844
【蜘蛛侠TG@abin789】-1845
【蜘蛛侠TG@abin789】-1846
【蜘蛛侠TG@abin789】-1847
【蜘蛛侠TG@abin789】-1848
【蜘蛛侠TG@abin789】-1849
【蜘蛛侠TG@abin789】-1850
【蜘蛛侠TG@abin789】-1851
【蜘蛛侠TG@abin789】-1852
【蜘蛛侠TG@abin789】-1853
【蜘蛛侠TG@abin789】-1854
【蜘蛛侠TG@abin789】-1855
【蜘蛛侠TG@abin789】-1856
【蜘蛛侠TG@abin789】-1857
【蜘蛛侠TG@abin789】-1858
【蜘蛛侠TG@abin789】-1859
【蜘蛛侠TG@abin789】-1860
【蜘蛛侠TG@abin789】-1861
【蜘蛛侠TG@abin789】-1862
【蜘蛛侠TG@abin789】-1863
【蜘蛛侠TG@abin789】-1864
【蜘蛛侠TG@abin789】-1865
【蜘蛛侠TG@abin789】-1866
【蜘蛛侠TG@abin789】-1867
【蜘蛛侠TG@abin789】-1868
【蜘蛛侠TG@abin789】-1869
【蜘蛛侠TG@abin789】-1870
【蜘蛛侠TG@abin789】-1871
【蜘蛛侠TG@abin789】-1872
【蜘蛛侠TG@abin789】-1873
【蜘蛛侠TG@abin789】-1874
【蜘蛛侠TG@abin789】-1875
【蜘蛛侠TG@abin789】-1876
【蜘蛛侠TG@abin789】-1877
【蜘蛛侠TG@abin789】-1878
【蜘蛛侠TG@abin789】-1879
【蜘蛛侠TG@abin789】-1880
【蜘蛛侠TG@abin789】-1881
【蜘蛛侠TG@abin789】-1882
【蜘蛛侠TG@abin789】-1883
【蜘蛛侠TG@abin789】-1884
【蜘蛛侠TG@abin789】-1885
【蜘蛛侠TG@abin789】-1886
【蜘蛛侠TG@abin789】-1887
【蜘蛛侠TG@abin789】-1888
【蜘蛛侠TG@abin789】-1889
【蜘蛛侠TG@abin789】-1890
【蜘蛛侠TG@abin789】-1891
【蜘蛛侠TG@abin789】-1892
【蜘蛛侠TG@abin789】-1893
【蜘蛛侠TG@abin789】-1894
【蜘蛛侠TG@abin789】-1895
【蜘蛛侠TG@abin789】-1896
【蜘蛛侠TG@abin789】-1897
【蜘蛛侠TG@abin789】-1898
【蜘蛛侠TG@abin789】-1899
【蜘蛛侠TG@abin789】-1900
【蜘蛛侠TG@abin789】-1901
【蜘蛛侠TG@abin789】-1902
【蜘蛛侠TG@abin789】-1903
【蜘蛛侠TG@abin789】-1904
【蜘蛛侠TG@abin789】-1905
【蜘蛛侠TG@abin789】-1906
【蜘蛛侠TG@abin789】-1907
【蜘蛛侠TG@abin789】-1908
【蜘蛛侠TG@abin789】-1909
【蜘蛛侠TG@abin789】-1910
【蜘蛛侠TG@abin789】-1911
【蜘蛛侠TG@abin789】-1912
【蜘蛛侠TG@abin789】-1913
【蜘蛛侠TG@abin789】-1914
【蜘蛛侠TG@abin789】-1915
【蜘蛛侠TG@abin789】-1916
【蜘蛛侠TG@abin789】-1917
【蜘蛛侠TG@abin789】-1918
【蜘蛛侠TG@abin789】-1919
【蜘蛛侠TG@abin789】-1920
【蜘蛛侠TG@abin789】-1921
【蜘蛛侠TG@abin789】-1922
【蜘蛛侠TG@abin789】-1923
【蜘蛛侠TG@abin789】-1924
【蜘蛛侠TG@abin789】-1925
【蜘蛛侠TG@abin789】-1926
【蜘蛛侠TG@abin789】-1927
【蜘蛛侠TG@abin789】-1928
【蜘蛛侠TG@abin789】-1929
【蜘蛛侠TG@abin789】-1930
【蜘蛛侠TG@abin789】-1931
【蜘蛛侠TG@abin789】-1932
【蜘蛛侠TG@abin789】-1933
【蜘蛛侠TG@abin789】-1934
【蜘蛛侠TG@abin789】-1935
【蜘蛛侠TG@abin789】-1936
【蜘蛛侠TG@abin789】-1937
【蜘蛛侠TG@abin789】-1938
【蜘蛛侠TG@abin789】-1939
【蜘蛛侠TG@abin789】-1940
【蜘蛛侠TG@abin789】-1941
【蜘蛛侠TG@abin789】-1942
【蜘蛛侠TG@abin789】-1943
【蜘蛛侠TG@abin789】-1944
【蜘蛛侠TG@abin789】-1945
【蜘蛛侠TG@abin789】-1946
【蜘蛛侠TG@abin789】-1947
【蜘蛛侠TG@abin789】-1948
【蜘蛛侠TG@abin789】-1949
【蜘蛛侠TG@abin789】-1950
【蜘蛛侠TG@abin789】-1951
【蜘蛛侠TG@abin789】-1952
【蜘蛛侠TG@abin789】-1953
【蜘蛛侠TG@abin789】-1954
【蜘蛛侠TG@abin789】-1955
【蜘蛛侠TG@abin789】-1956
【蜘蛛侠TG@abin789】-1957
【蜘蛛侠TG@abin789】-1958
【蜘蛛侠TG@abin789】-1959
【蜘蛛侠TG@abin789】-1960
【蜘蛛侠TG@abin789】-1961
【蜘蛛侠TG@abin789】-1962
【蜘蛛侠TG@abin789】-1963
【蜘蛛侠TG@abin789】-1964
【蜘蛛侠TG@abin789】-1965
【蜘蛛侠TG@abin789】-1966
【蜘蛛侠TG@abin789】-1967
【蜘蛛侠TG@abin789】-1968
【蜘蛛侠TG@abin789】-1969
【蜘蛛侠TG@abin789】-1970
【蜘蛛侠TG@abin789】-1971
【蜘蛛侠TG@abin789】-1972
【蜘蛛侠TG@abin789】-1973
【蜘蛛侠TG@abin789】-1974
【蜘蛛侠TG@abin789】-1975
【蜘蛛侠TG@abin789】-1976
【蜘蛛侠TG@abin789】-1977
【蜘蛛侠TG@abin789】-1978
【蜘蛛侠TG@abin789】-1979
【蜘蛛侠TG@abin789】-1980
【蜘蛛侠TG@abin789】-1981
【蜘蛛侠TG@abin789】-1982
【蜘蛛侠TG@abin789】-1983
【蜘蛛侠TG@abin789】-1984
【蜘蛛侠TG@abin789】-1985
【蜘蛛侠TG@abin789】-1986
【蜘蛛侠TG@abin789】-1987
【蜘蛛侠TG@abin789】-1988
【蜘蛛侠TG@abin789】-1989
【蜘蛛侠TG@abin789】-1990
【蜘蛛侠TG@abin789】-1991
【蜘蛛侠TG@abin789】-1992
【蜘蛛侠TG@abin789】-1993
【蜘蛛侠TG@abin789】-1994
【蜘蛛侠TG@abin789】-1995
【蜘蛛侠TG@abin789】-1996
【蜘蛛侠TG@abin789】-1997
【蜘蛛侠TG@abin789】-1998
【蜘蛛侠TG@abin789】-1999
【蜘蛛侠TG@abin789】-2000

0 回复 有任何疑惑可以回复我~

$butLeft = $(".butLeft");
        $butRight = $(".butRight");
        $butPlay = $(".butPlay");
        $imglist = $(".mainbox ul li");

这段代码的符号错误

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Jquery插件transform旋转焦点图
  • 参与学习       31563    人
  • 解答问题       52    个

本视频教程教你制作带旋转效果的焦点图轮播器,结合案例学的更快

进入课程

点击播放下一组图片的时候是空白,没有图片,但是也没有报错,是什么问题

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信