Home > Web Front-end > JS Tutorial > How to implement h5 routing jump

How to implement h5 routing jump

一个新手
Release: 2017-10-17 10:22:09
Original
3285 people have browsed it

Route jump, there are two ways of expression

1 Horizontal

:

The code is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="angular.js" type="text/javascript"></script>
    <script src="angular-route.js" type="text/javascript"></script>
    <title>路由</title>
    <style type="text/css">
        li {
            list-style: none;
            float: left;
            margin: 8px;
        }
    </style>
    <script type="text/javascript">
        var app = angular.module("myApp", ["ngRoute"]);

        app.config(["$routeProvider", function ($routeProvider) {
            $routeProvider
                    .when("/index", {template: "<p><h2>首页</h2><hr><br><br><br><br><br><br><br><br><br><br><br><br></p>"})
                    .when("/news", {template: "<p><h2>新闻页面</h2><hr><br><br><br><br><br><br><br><br><br><br><br><br></p>"})
                    .when("/sport", {template: "<p><h2>体育页面</h2><hr><br><br><br><br><br><br><br><br><br><br><br><br></p>"})
                    .when("/game", {template: "<p><h2>游戏页面</h2><hr><br><br><br><br><br><br><br><br><br><br><br><br></p>"})
                    .otherwise({template: "<p><h2>404 Page Not Found!</h2><hr><br><br><br><br><br><br><br><br><br><br><br><br></p>"});
        }]);
    </script>
</head>
<body ng-app="myApp">
<ul>
    <li><a href="#/index">首页</a></li>
    <li><a href="#/news">新闻</a></li>
    <li><a href="#/sport">体育</a></li>
    <li><a href="#/game">游戏</a></li>
    <li><a href="#/other">其他</a></li>
</ul>

<p style="clear: both"></p>

<ng-view></ng-view>
</body>
</html>
Copy after login

2.Vertical:


The code is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>锚点</title>
    <style type="text/css">
        li {
            list-style: none;
            float: left;
            margin: 8px;
        }
    </style>
</head>
<body>
<ul>
    <li><a href="#index">首页</a></li>
    <li><a href="#news">新闻</a></li>
    <li><a href="#sport">体育 </a></li>
    <li><a href="#game">游戏</a></li>
</ul>

<p style="clear: both"></p>

<p>
    <a id="index"></a>

    <h2>首页</h2>
    <hr>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
</p>

<p>
    <a id="news"></a>

    <h2>新闻页面</h2>
    <hr>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
</p>

<p>
    <a id="sport"></a>

    <h2>体育页面</h2>
    <hr>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
</p>

<p>
    <a id="game"></a>

    <h2>游戏页面</h2>
    <hr>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
    <br><br><br><br><br><br>
</p>
</body>
</html>
Copy after login


The above is the detailed content of How to implement h5 routing jump. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template