Guest User

Untitled

a guest
Jan 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. // Avoid conflict
  2. jQuery.noConflict();
  3.  
  4. var FADE_DURATION = 150;
  5. var SCROLL_VELOCITY = 500;
  6. var SCROLL_EFFECT = 'easeInOutCubic';
  7.  
  8. jQuery(document).ready(function(){
  9. // If IE, turn off animations.
  10. if (jQuery.browser.msie) {
  11. FADE_DURATION = 0;
  12. }
  13.  
  14. // IE6 PNG transparent (with image rollover)
  15. if (jQuery.browser.msie && jQuery.browser.version <= 6) {
  16. var orgFixPng = DD_belatedPNG.fixPng;
  17. DD_belatedPNG.fixPng = function (el) {
  18. orgFixPng(el);
  19. if (el.vml && el.vml.image.fill.getAttribute("src").match(/_off\./)) {
  20. el.vml.image.shape.attachEvent('onmouseenter', function() {
  21. var image = el.vml.image.fill;
  22. image.setAttribute("src", image.getAttribute("src").replace("_off.", "_on."));
  23. });
  24. el.vml.image.shape.attachEvent('onmouseleave', function() {
  25. var image = el.vml.image.fill;
  26. image.setAttribute("src", image.getAttribute("src").replace("_on.", "_off."));
  27. });
  28. }
  29. };
  30. DD_belatedPNG.fix('img');
  31. }
  32.  
  33. // Rollover(Swap)
  34. jQuery('.hover').hover(function(){
  35. jQuery(this).attr('src', this.src.replace('_off', '_on'));
  36. }, function(){
  37. jQuery(this).attr('src', this.src.replace('_on', '_off'));
  38. });
  39.  
  40. // Fade
  41. jQuery('.fade').hover(function(){
  42. jQuery(this).fadeTo(FADE_DURATION, 0.8);
  43. }, function(){
  44. jQuery(this).fadeTo(FADE_DURATION, 1.0);
  45. });
  46.  
  47. // Smooth scrolling
  48. jQuery('a[href*=#]').click(function(){
  49. if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  50. var $target = jQuery(this.hash);
  51. $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
  52. if ($target.length) {
  53. var targetOffset = $target.offset().top;
  54. jQuery('html,body').animate({ scrollTop: targetOffset }, SCROLL_VELOCITY, SCROLL_EFFECT);
  55. return false;
  56. }
  57. }
  58. });
  59. });
Add Comment
Please, Sign In to add comment