国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - 用section標(biāo)簽后,input會(huì)失效是什么原因
高洛峰
高洛峰 2017-04-11 12:18:03
0
1
345

在微信html5中,做了上下滑動(dòng)翻頁效果,js獲取的是section標(biāo)簽, 也就意味著每一個(gè)翻頁的內(nèi)容都要用section包裹,但在section包裹之下,用input 會(huì)失效,把input單獨(dú)提取出來不被sectoin包裹,實(shí)現(xiàn)起來就沒有問題。下面是代碼:

    <section id="s1" data="1" >
        <input type="file"  style="    position: absolute;top: 70%;z-index: 9;" />
        <img class="head_img" data="img/head_img1.png" alt="" src="img/head_img1.png">  
    </section>

下面是js代碼(滑動(dòng)效果):

var sections = document.querySelectorAll('section');
var nowData=1 , nextData , preData , nowId , nextId , preId;
        var animation = false;

        var startY, moveY;

        this.touchStart = function(event,target){

            event.preventDefault();

            var touch = event.targetTouches[0]; //位于當(dāng)前DOM元素上的手指的一個(gè)列表

            startY = touch.pageY;

            moveY = 0;

        }
        
        this.touchMove = function(event){

            event.preventDefault();

            var touch = event.touches[0];

            moveY = touch.pageY - startY;
            
        }

        this.touchEnd = function(event){

            event.preventDefault();

            if (animation == false) {

                nowData = parseInt(this.getAttribute('data'));

                nowId = document.getElementById('s' + nowData);

                nextData = nowData + 1;

                nextId = document.getElementById('s' + nextData);

                preData = nowData - 1;

                preId = document.getElementById('s' + preData);

                if (moveY < -50 && nowData < sections.length) {

                    $(".rightan").show();

                    if (nowData==6) {$(".rightan").hide();}

                    animation = true;

                    nowId.style.zIndex = '11';

                    nextId.style.zIndex = '20';

                    nextId.style.display = 'block';

                    nowId.className = 'pt-page-moveToTop pt-page-ontop';

                    nextId.className = 'pt-page-scaleUp';

                    setTimeout(function(){
                        nowId.style.display = 'none';
                        animation = false;
                    },600);

                }else if(moveY > 50 && nowData!=1 ){

                    $(".rightan").show();

                    if (nowData==6) {$(".rightan").show();}
                    if (nowData==2) {$(".rightan").hide();}

                    animation = true;

                    nowId.style.zIndex = '11';

                    preId.style.zIndex = '20';

                    preId.style.display = 'block';

                    nowId.className = 'pt-page-moveToBottom pt-page-ontop';

                    preId.className = 'pt-page-scaleUp';
                    
                    setTimeout(function(){
                        nowId.style.display = 'none';
                        animation = false;
                    },600);
                }

            }
        }
高洛峰
高洛峰

擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級(jí)軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...

reply all(1)
劉奇

input輸入的時(shí)候的click事件,被你的touchstart回調(diào)阻止了。。。。e.preventDefault

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template