Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.27 KB | None | 0 0
  1. export class NavbarComponent implements OnInit {
  2.  
  3. // Navbar
  4. opacityNavbar: number = 0;
  5.  
  6. constructor() { }
  7.  
  8. ngOnInit() {
  9. this.animateScrolling();
  10. this.activeOpacityNavbar();
  11. this.activeNavbar();
  12. }
  13.  
  14. onNavbar() {
  15. $('.navbar-collapse').collapse('toggle');
  16. }
  17.  
  18. animateScrolling() {
  19. $("a").on('click', function () {
  20. let select = $(this).attr("href");
  21. let positionAux = $(select).offset().top;
  22. let position: number;
  23. if (select == "#home") {
  24. position = 0;
  25. } else if (select == "#about") {
  26. position = positionAux - 73;
  27. } else if (select == "#services") {
  28. position = positionAux + 127;
  29. } else if (select == "#contact") {
  30. position = positionAux - 43;
  31. }
  32. $("html, body").animate({ scrollTop: position }, 600);
  33. });
  34. }
  35.  
  36. activeNavbar() {
  37. $(document).scroll(function () {
  38. var opacityNavbar = $(this).scrollTop();
  39. if (opacityNavbar >= ($("#home").offset().top) && opacityNavbar < ($("#about").offset().top) - 73) {
  40. $(".home-nav").addClass("active");
  41. $(".about-nav").removeClass("active");
  42. $(".services-nav").removeClass("active");
  43. $(".contact-nav").removeClass("active");
  44. } else if (opacityNavbar >= ($("#about").offset().top) - 80 && opacityNavbar < ($("#services").offset().top) + 127) {
  45. $(".home-nav").removeClass("active");
  46. $(".about-nav").addClass("active");
  47. $(".services-nav").removeClass("active");
  48. $(".contact-nav").removeClass("active");
  49. } else if (opacityNavbar > ($("#services").offset().top) + 126 && opacityNavbar < ($("#contact").offset().top) - 44) {
  50. $(".home-nav").removeClass("active");
  51. $(".about-nav").removeClass("active");
  52. $(".services-nav").addClass("active");
  53. $(".contact-nav").removeClass("active");
  54. } else if (opacityNavbar >= ($("#contact").offset().top) - 43) {
  55. $(".home-nav").removeClass("active");
  56. $(".about-nav").removeClass("active");
  57. $(".services-nav").removeClass("active");
  58. $(".contact-nav").addClass("active");
  59. }
  60. });
  61. }
  62.  
  63. activeOpacityNavbar() {
  64. $(document).scroll(function () {
  65. var opacityNavbar = $(this).scrollTop();
  66. if (opacityNavbar > ($("#about").offset().top) - 40) {
  67. $(".navbar").addClass("opacity-navbar");
  68. } else {
  69. $(".navbar").removeClass("opacity-navbar");
  70. }
  71. });
  72. }
  73. }
  74.  
  75. <section id="navbar">
  76. <app-navbar></app-navbar>
  77. </section>
  78.  
  79. <section id="home">
  80. <app-home></app-home>
  81. </section>
  82.  
  83. <section id="about">
  84. <app-about-me></app-about-me>
  85. </section>
  86.  
  87. <section id="skills">
  88. <app-skills></app-skills>
  89. </section>
  90.  
  91. <section id="services">
  92. <app-posts></app-posts>
  93. </section>
  94.  
  95. <section id="contact">
  96. <app-contact></app-contact>
  97. </section>
  98.  
  99. <section>
  100. <app-footer></app-footer>
  101. </section>
  102. <app-flags></app-flags>
  103.  
  104. <div class="bg font">
  105. <div class="container">
  106. <div class="row">
  107. <div class="card blue-card col-6">
  108. <br><br>
  109. <i class="fas fa-user-astronaut icon text-center"></i>
  110. <br><br>
  111. <h1 class="welcome text-center">SEJA BEM-VINDO <br> AO PAINEL ADMINISTRATIVO</h1>
  112. <img class="logo" src="srcassetsimagesLogo Hunter (sem fundo e branco).png" alt="">
  113. </div>
  114. <div class="card pink-card col-6">
  115. <br><br>
  116. <i class="fas fa-space-shuttle icon text-center"></i>
  117. <br><br>
  118. <form>
  119. <div class="form-group">
  120. <label>USUÁRIO</label>
  121. <input [(ngModel)]="email" [ngModelOptions]="{standalone: true}" type="text"
  122. class="form-control" id="credential" placeholder="Digite o usuário">
  123. </div>
  124. <div class="form-group">
  125. <label>SENHA</label>
  126. <input [(ngModel)]="password" [ngModelOptions]="{standalone: true}" type="password"
  127. class="form-control" id="exampleInputPassword1" placeholder="Digite a senha">
  128. </div>
  129. <br><br><br>
  130. <div *ngIf="loading" class="row">
  131. <div class="col-12 text-center">
  132. <app-lds-facebook-blue></app-lds-facebook-blue>
  133. </div>
  134. </div>
  135. <button *ngIf="!loading" [disabled]="email == '' || password == ''" (click)="login()" type="button"
  136. class="btn">CONECTAR</button>
  137. </form>
  138. </div>
  139. </div>
  140.  
  141. <div class="modal font-black" tabindex="-1" role="dialog" id="errorModal">
  142. <div class="modal-dialog modal-dialog-centered" role="document">
  143. <div class="modal-content">
  144. <div class="modal-header">
  145. <h5 class="modal-title">Não foi possível fazer log in</h5>
  146. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  147. <span aria-hidden="true">&times;</span>
  148. </button>
  149. </div>
  150. <div class="modal-body">
  151. <h6>{{ error }}</h6>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157.  
  158. const routes: Routes = [
  159. {
  160. path: '',
  161. component: MainComponent
  162. }, {
  163. path: 'login',
  164. component: LoginComponent
  165. }, {
  166. path: 'access-denied',
  167. component: GuardsErrorComponent
  168. }, {
  169. path: 'admin',
  170. component: AdminMainComponent,
  171. canActivate: [GuardsService],
  172. children: [
  173. { path: '', redirectTo: 'home', pathMatch: 'full' }, {
  174. path: 'home',
  175. component: AdminHomeComponent,
  176. canActivate: [GuardsService]
  177. }, {
  178. path: 'about',
  179. component: AdminAboutComponent,
  180. canActivate: [GuardsService]
  181. }, {
  182. path: 'posts',
  183. component: AdminProjectsComponent,
  184. canActivate: [GuardsService]
  185. },
  186. ]
  187. },
  188. { path: 'home', redirectTo: '', pathMatch: 'full' },
  189. { path: 'about', redirectTo: '', pathMatch: 'full' },
  190. { path: 'services', redirectTo: '', pathMatch: 'full' },
  191. { path: 'contact', redirectTo: '', pathMatch: 'full' },
  192. { path: '**', component: NotFoundComponent },
  193. ];
  194.  
  195. @NgModule({
  196. imports: [RouterModule.forRoot(routes, { useHash: true })],
  197. exports: [RouterModule]
  198. })
  199.  
  200. export class AppRoutingModule { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement