global.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. $(document).ready(function () {
  2. /* GLOBAL SCRIPTS */
  3. $('#top-nav li').hover(
  4. function () {
  5. $('ul', this).slideDown(100);
  6. },
  7. function () {
  8. $('ul', this).slideUp(100);
  9. }); /*for the dropdown sub-nav*/
  10. $('.ad-notif-success, .ad-notif-warn, .ad-notif-error, .ad-notif-info').click(function() {
  11. $(this).slideUp(300);
  12. }); /* for dismissing notifications */
  13. $('#usr-notif a').click(function () {
  14. $.sticky('Well hello there!');
  15. }); /* for displaying a sticky notification */
  16. $('.box-head').click(function() {
  17. $(this).next(".box-content").css("min-height", "0").slideToggle(400);
  18. }); /* for collapsing panels on header click */
  19. var link = $("<link>");
  20. link.attr({
  21. type: 'text/css',
  22. rel: 'stylesheet',
  23. href: 'css/icons.css'
  24. });
  25. if($('.silk, .fugue, .fugue-2, .fugue-24, .opsrc').length>0) {
  26. $("head").append( link );
  27. }; /* for only including "icons.css" (big file) if an icon class is used anywhere in the page */
  28. /* FOR ADAPTIVE LAYOUT, remove if not needed */
  29. function fullHeight(){
  30. if ($(window).width() > 600) {
  31. if ($(window).width() < 1250) {
  32. $(".top-bar").height($(document).height());
  33. }
  34. else {
  35. $(".top-bar").height(80);
  36. }
  37. }
  38. else {
  39. $(".top-bar").height(30);
  40. }
  41. }
  42. fullHeight();
  43. $(window).resize(function(){
  44. fullHeight();
  45. });
  46. /* sets the .top-bar height to 100% of document height if resolution smaller than 1250px and larger than 600px */
  47. });