Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. <div>
  2. <ul>
  3. <li>
  4. <div class="home-heading">Home</div>
  5. </li>
  6. <li>
  7. <div class="products-heading">Products</div>
  8. </li>
  9. <li>
  10. <div class="about-heading">About Us</div>
  11. </li>
  12. <li>
  13. <div class="contact-heading">Contact us</div>
  14. </li>
  15. </ul>
  16. </div>
  17.  
  18. <div class="home">
  19. Welcome to Home
  20. </div>
  21.  
  22. <div class="products">
  23. Welcome to Products
  24. </div>
  25.  
  26. <div class="about">
  27. Welcome to About Us
  28. </div>
  29.  
  30. <div class="contact">
  31. Welcome to Contact Us
  32. </div>
  33.  
  34. $('.home-heading').on('click', function() {
  35. $(".home").show();
  36. $(".products").hide();
  37. $(".about").hide();
  38. $(".contact").hide();
  39. });
  40.  
  41. $('.products-heading').on('click', function() {
  42. $(".home").hide();
  43. $(".products").show();
  44. $(".about").hide();
  45. $(".contact").hide();
  46. });
  47.  
  48. $('.about-heading').on('click', function() {
  49. $(".home").hide();
  50. $(".products").hide();
  51. $(".about").show();
  52. $(".contact").hide();
  53. });
  54.  
  55.  
  56. $('.contact-heading').on('click', function() {
  57. $(".home").hide();
  58. $(".products").hide();
  59. $(".about").hide();
  60. $(".contact").show();
  61. });
  62.  
  63. <div ng-controller="TestController">
  64. <ul>
  65. <li>
  66. <div class="home-heading" ng-click="showHome()">Home</div>
  67. </li>
  68. <li>
  69. <div class="products-heading" ng-click="showProducts()">Products</div>
  70. </li>
  71. <li>
  72. <div class="about-heading" ng-click="showAboutUs()">About Us</div>
  73. </li>
  74. <li>
  75. <div class="contact-heading" ng-click="showContact()">Contact us</div>
  76. </li>
  77. </ul>
  78. </div>
  79.  
  80. <div class="home">
  81. Welcome to Home
  82. </div>
  83.  
  84. <div class="products">
  85. Welcome to Home
  86. </div>
  87.  
  88. <div class="about">
  89. Welcome to Home
  90. </div>
  91.  
  92. <div class="contact">
  93. Welcome to Home
  94. </div>
  95.  
  96. require(['app'], function(app) {
  97. app.controller("TestController", function($scope) {
  98.  
  99. $scope.showHome = function() {
  100. alert('showHome is responding');
  101. };
  102.  
  103. $scope.showProducts = function() {
  104. alert('showProducts is responding');
  105. };
  106.  
  107. });
  108. });
  109.  
  110. <div class="home" ng-show="ShowHomeContainer">
  111. Welcome to Home
  112. </div>
  113.  
  114. $scope.ShowHomeContainer = false;
  115.  
  116. $scope.showHome = function(){
  117. $scope.ShowHomeContainer = true;
  118. };
  119.  
  120. <body ng-app="ngAnimate">
  121. <div ng-init="checked=true">
  122. <label>
  123. <input type="checkbox" ng-model="checked" style="float:left; margin-right:10px;"> Is Visible...
  124. </label>
  125. <div class="check-element sample-show-hide" ng-show="checked" style="clear:both;">
  126. Visible...
  127. </div>
  128. </div>
  129. </body>
  130.  
  131. .sample-show-hide {
  132. padding:10px;
  133. border:1px solid black;
  134. background:white;
  135. }
  136.  
  137. .sample-show-hide.ng-hide-add, .sample-show-hide.ng-hide-remove {
  138. -webkit-transition:all linear 0.5s;
  139. -moz-transition:all linear 0.5s;
  140. -o-transition:all linear 0.5s;
  141. transition:all linear 0.5s;
  142. display:block!important;
  143. }
  144.  
  145. .sample-show-hide.ng-hide-add.ng-hide-add-active,
  146. .sample-show-hide.ng-hide-remove {
  147. opacity:0;
  148. }
  149.  
  150. .sample-show-hide.ng-hide-add,
  151. .sample-show-hide.ng-hide-remove.ng-hide-remove-active {
  152. opacity:1;
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement