找传奇、传世资源到传世资源站!

angular 实现 tab切换导航

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

<!DOCTYPE html><html lang="en" ng-app="app" ng-controller="myController"><head> <meta charset="UTF-8"> <title>{{title}}</title> <style type="text/css"> * { padding: 0; margin: 0; list-style: none; } .box { width: 1000px; margin: 30px auto; } .box .title { width: 400px; height: 44px; position: relative; top: 3px; background: #fff; } .box .content { width: 1000px; height: 475px; } .box .content img { width: 400px; } .box ul { display: flex; } .box ul li { flex: 1; text-align: center; } .box ul .cur { color: darkorange; } </style></head><body><div class="box"> <div class="title"> <ul> <li ng-class="{cur:person == '水门'}" ng-mouseover="move('水门')">水门</li> <li ng-class="{cur:person == '自来也'}" ng-mouseover="move('自来也')">自来也</li> <li ng-class="{cur:person == '卡卡西'}" ng-mouseover="move('卡卡西')">卡卡西</li> <li ng-class="{cur:person == '鸣人'}" ng-mouseover="move('鸣人')">鸣人</li> </ul> </div> <div class="content" ng-switch="person"> <div ng-switch-default><img src="image/01.jpg" alt=""></div> <div ng-switch-when="自来也"><img src="image/02.jpg" alt=""></div> <div ng-switch-when="卡卡西"><img src="image/03.jpg" alt=""></div> <div ng-switch-when="鸣人"><img src="image/04.jpg" alt=""></div> </div></div><script src="js/angular.js"></script><script> // 创建模块 var app = angular.module('app', []); // 创建控制器 app.controller('myController', ['$scope', function ($scope) { $scope.title = 'tab'; $scope.person = '水门'; // 绑定事件 $scope.move = function (regs) { $scope.person = regs; } }]);</script></body></html>

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复