帖子
帖子
用户
博客
课程
显示全部楼层
7
帖子
0
勋章
113
Y币

[插件开发] api.closeWin();没有效果,求高手帮助!!!!!

[复制链接]
发表于 2015-8-25 15:02:29
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>底部导航</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>

</head>
<body>
<div id="wrap">


<header>
    <div class="index header ">
        <a class="menu" tapmode=""></a>
        <div class="title" > 舞林cuzn </div>
        <a  onclick="closeWin();">返回</a>
    </div>
</header>
<!--
    <header>
        <div id="cloud" class="topbar  activebar">
                    舞林cuzn
        </div>
    </header>
-->
    <div id="main">


    </div>
    <div id="footer">
        <ul>
            <li tapmode="active" class="active">
                <a href="../index.html" class="bottom_btn cloud">首页</a>
            </li>
        </ul>
    </div>
   
   
   
   
</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script>




        function closeWin(){
        alert(1);
        api.closeWin();
    }


    function sliding() {
                api.openSlidLayout ({
                    type: 'left',
                    rightEdge:80,
                    fixedPane: {
                        name: 'win1',
                        url: '../index.html',
                        bgColor: '#fff',
                        bounces:true,
                        vScrollBarEnabled:true,
                        hScrollBarEnabled:false
                    },
                    slidPane: {
                        name: 'win2',
                        url: 'fixed.html',
                        bgColor: '#fff',
                        bounces:true,
                        vScrollBarEnabled:true,
                        hScrollBarEnabled:false
                    }
                }, function(ret){
                    var type = ret.type;
                    if (type == 'left') {
//                                api.openSlidPane({type: 'left'});
                    } else {
//                                api.openSlidPane({type: 'left'});
                    }
                });
//                api.openSlidPane({type: 'left'});
    }
</script>
<script type="text/javascript">
    apiready = function () {
        var $header = $api.dom('header');
        $api.fixIos7Bar($header);
        var $body = $api.dom('body');
        var $footer = $api.byId('footer');
        var header_h = $api.offset($header).h;
        var body_h = $api.offset($body).h;
        var footer_h = $api.offset($footer).h;
        var rect_h = body_h - header_h - footer_h;
        
        
        api.openFrame({
            name: 'showcontent',
            url: 'showcontent.html',
            rect: {
                x : 0,
                y : header_h,
                w : 'auto',
                h : rect_h
            },
            pageParam: {'gid': api.pageParam['gid']},
            bounces: false
        })
        
    }
    // 随意切换按钮
    function randomSwitchBtn(obj, name, index) {
        var $header = $api.dom('header');
        var $titleBar = $api.domAll($header, '.topbar');
        for (var i = 0; i < $titleBar.length; i++) {
            $api.removeCls($titleBar, 'activebar');
        }
        $api.addCls($api.byId(name), 'activebar');
        var $footer = $api.byId('footer');
        var $footerBar = $api.domAll($footer, 'li');
        for (var j = 0; j < $footerBar.length; j++) {
            $api.removeCls($footerBar[j], 'active');
        }
        $api.addCls(obj, 'active');
        api.setFrameGroupIndex({
            name: 'group',
            index: index
        });


    }
</script>
</html>






我是从index.html  打开一个新的 openFrameGroup  进入这个页面的 我想点击返回关闭这个页面或者返回index.html

5
帖子
0
勋章
1万+
Y币
应该closeFrame()
7
帖子
0
勋章
113
Y币
closeFrame()  确实可以关闭 但是不是我要的效果  
我把整个结构重新写了 打开都用 openWin  这样就OK了
5
帖子
0
勋章
1万+
Y币
cuzn 发表于 2015-8-25 16:15
closeFrame()  确实可以关闭 但是不是我要的效果  
我把整个结构重新写了 打开都用 openWin  这样就OK了 ...

用openFrame打开的页面,用closeFrame关闭
用openWin打开的页面,用closeWin关闭
您需要登录后才可以回帖 登录

本版积分规则