Tony_shen
Tony_shen
  • 发布:2016-06-16 10:49
  • 更新:2016-06-16 10:49
  • 阅读:1768

HBuild真机运行时,jgestures插件好像没生效,手势没用,用浏览器运行是可以滑动图票的。

分类:HBuilder

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" manifest="cache.manifest">
<head runat="server">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" minimum-scale="1.0" />
<meta name="apple-touch-fullscreen" content="yes"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

<link href="bootstrap.min.css" rel="stylesheet" type="text/css" />  
<link href="../images/Fish_logo.png" rel="icon"/>  
<link href="../images/Fish_logo.png" rel="apple-touch-icon"/>  
<link href="../images/Fish_logo.png" rel="apple-touch-icon-precomposed"/>  

<!-- <script src="../Common.js" type="text/javascript"></script>-->
<style type="text/css">
.a
{
outline: none;
}
.click{background:#ccd2ff;}
.carousel-inner img{margin:0 auto}
.carousel-control{font-size :80px;}

foot{position:fixed;_position:absolute;bottom:0px;_bottom:0px;_margin-top:expression(this.style.pixelHeight+document.documentElement.scrollTop)}

</style>  
<title>鱼天地</title>  

</head>
<body id="body">
<form id="form1" >
<!--Carousel -->
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner" id="carouselContent" style="background-color:Black">
<!-- <div id="11" class="item active"><img src="Pictures/cishen01.jpg" /></div>-->
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;&nbsp;&nbsp;&nbsp;&nbsp;</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">&nbsp;&nbsp;&nbsp;&nbsp;&rsaquo;</a>
<!-- <a class="carousel-control left" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left">&lsaquo;</span></a>
<a class="carousel-control right" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right">&rsaquo;</span></a>-->
</div>
</form>

<div style="padding-top:10px;padding-bottom:5px; font-size:20pt" id="foot">  
    <ul class="nav nav-pills">  
      <li disabled>&nbsp;<img id="logo" src="../images/Fish_logo.png"  style="height:50px;width:50px" ) />&nbsp;</li>   
      <li role="presentation" class="active"> <button id="cishen"  class="btn btn-default" onclick='position("101")' style="margin-left:3px;margin-right:3px;font-size:16pt" >热推</button></li>  
      <li role="presentation"> <button id="lengyao" class="btn btn-default" onclick='position("201")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >冷肴</button></li>  
      <li role="presentation"> <button id="shoujuan" class="btn btn-default" onclick='position("301")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >寿司</button></li>  
      <li role="presentation"> <button id="shala" class="btn btn-default" onclick='position("401")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >卷物</button></li>  
      <li role="presentation"> <button id="qita" class="btn btn-default" onclick='position("501")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >热烹</button></li>  
      <li role="presentation"> <button id="Button1" class="btn btn-default" onclick='position("601")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >主食</button></li>  
      <li role="presentation"> <button id="Button2" class="btn btn-default" onclick='position("701")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >饮品</button></li>  
      <li role="presentation"> <button id="Button3" class="btn btn-default" onclick='position("801")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >甜品</button></li>  
      <li role="presentation"> <button id="Button4" class="btn btn-default" onclick='position("901")'  style="margin-left:3px;margin-right:3px;font-size:16pt" >酒类</button></li>  
    </ul>  
</div>  

<script src="jquery.min.js" type="text/javascript"></script>  
<script src="bootstrap.min.js" type="text/javascript"></script>  
<script src="jgestures.min.js" type="text/javascript"></script>  
<script  type="text/javascript">  

// $(function () {

// //加载PIC
// var xmlDom = loadXMLDoc("Pictures.xml");
// // var data = xmlDom.documentElement;
// var Pic = xmlDom.getElementsByTagName("Pic");
//
// for (i = 0; i < Pic.length; i++) {
// var flag = false;
// if (Pic[i].attributes.getNamedItem("id")) {
// var _picId = Pic[i].attributes.getNamedItem("id").nodeValue;
// if (Pic[i].childNodes[0]) {
// var _pic = Pic[i].childNodes[0].nodeValue;
// var reg = new RegExp("Blank", "ig");
// var res = reg.test(_pic);
// if (!res) {
// flag = true;
// }
//
// } else {
// flag = false;
// }
//
// } else {
// flag = false;
// alert("第" + (i + 1).toString() + "个图片没有ID");
// }
//
// if (flag) {
// if (i == 0) {//首次插入图片
// var html = '<div id="' + _picId + '" class="item active"><img src="' + _pic + '" /></div>';
// } else {
// var html = '<div id="' + _picId + '" class="item"><img src="' + _pic + '" /></div>';
// }
//
// document.getElementById("carouselContent").innerHTML += html;
// }
// }
//
// //设置垂直剧中
// $(".carousel-control").css("top", $(window).height() / 2 + "px");
// $(window).resize(function () {
// // var $height = $(".carousel-inner img").eq(0).height() || $(".carousel-inner img").eq(1).height()||$(".carousel-inner img").eq(2).height()
// // $(".carousel-control").css("line-height", $height);})
// $(".carousel-control").css("top", $(window).height() / 2 + "px");
// })
// //手势右滑 回到上一个画面
// $('#myCarousel').bind('swiperight swiperightup swiperightdown', function () {
// $("#myCarousel").carousel('prev');
// })
// //手势左滑 进入下一个画面
// $('#myCarousel').bind('swipeleft swipeleftup swipeleftdown', function () {
// $("#myCarousel").carousel('next');
// })

// })

    // 扩展API是否准备好,如果没有则监听“plusready"事件  

    if(window.plus){  

        plusReady();  

    }else{   

        document.addEventListener( "plusready", plusReady, false );  

    }  

    // 扩展API准备完成后要执行的操作  

    function plusReady(){  

        var ws = plus.webview.currentWebview(); //pw回车可输出plus.webview  

        //加载PIC  
        var xmlDom = loadXMLDoc("Pictures.xml");  
        //            var data = xmlDom.documentElement;  
        var Pic = xmlDom.getElementsByTagName("Pic");  

        for (i = 0; i < Pic.length; i++) {  
            var flag = false;  
            if (Pic[i].attributes.getNamedItem("id")) {  
                var _picId = Pic[i].attributes.getNamedItem("id").nodeValue;  
                if (Pic[i].childNodes[0]) {  
                    var _pic = Pic[i].childNodes[0].nodeValue;  
                    var reg = new RegExp("Blank", "ig");  
                    var res = reg.test(_pic);  
                    if (!res) {  
                        flag = true;  
                    }  

                } else {  
                    flag = false;  
                }  

            } else {  
                flag = false;  
                alert("第" + (i + 1).toString() + "个图片没有ID");  
            }  

            if (flag) {  
                if (i == 0) {//首次插入图片  
                    var html = '<div id="' + _picId + '" class="item active"><img src="' + _pic + '" /></div>';  
                } else {  
                    var html = '<div id="' + _picId + '" class="item"><img src="' + _pic + '" /></div>';  
                }  

                document.getElementById("carouselContent").innerHTML += html;  
            }  
        }  

        //设置垂直剧中  
        $(".carousel-control").css("top", $(window).height() / 2 + "px");  
        $(window).resize(function () {  
            //                var $height = $(".carousel-inner img").eq(0).height() || $(".carousel-inner img").eq(1).height()||$(".carousel-inner img").eq(2).height()  
            //               $(".carousel-control").css("line-height", $height);})  
            $(".carousel-control").css("top", $(window).height() / 2 + "px");  
        })  
        //手势右滑 回到上一个画面   
        $('#myCarousel').bind('swiperight swiperightup swiperightdown', function () {  
            $("#myCarousel").carousel('prev');  
        })  
        //手势左滑 进入下一个画面   
        $('#myCarousel').bind('swipeleft swipeleftup swipeleftdown', function () {  
            $("#myCarousel").carousel('next');  
        })  

    }  

    function loadXMLDoc(file_path) {  
        try {  
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari  
                xmlhttp = new XMLHttpRequest();  
            }  
            else {// code for IE6, IE5  
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");  
            }  

            xmlhttp.open("GET", file_path, false);  
            xmlhttp.send();  
            return (xmlhttp.responseXML);  
        } catch (e) { throw new Error("该浏览器无法执行该程序!"); }  

    }  

 function position(obj) {  

    if (document.getElementById(obj)) {  
        $(".item,.active").removeClass("item active").addClass("item");  
       document.getElementById(obj).className = "item active";  
  } else {  
      alert("对不起,暂时无此类菜品,敬请期待!");  
    }  
}  

</script>  

</body>
</html>

2016-06-16 10:49 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复