Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Avoid conflict
- jQuery.noConflict();
- var FADE_DURATION = 150;
- var SCROLL_VELOCITY = 500;
- var SCROLL_EFFECT = 'easeInOutCubic';
- jQuery(document).ready(function(){
- // If IE, turn off animations.
- if (jQuery.browser.msie) {
- FADE_DURATION = 0;
- }
- // IE6 PNG transparent (with image rollover)
- if (jQuery.browser.msie && jQuery.browser.version <= 6) {
- var orgFixPng = DD_belatedPNG.fixPng;
- DD_belatedPNG.fixPng = function (el) {
- orgFixPng(el);
- if (el.vml && el.vml.image.fill.getAttribute("src").match(/_off\./)) {
- el.vml.image.shape.attachEvent('onmouseenter', function() {
- var image = el.vml.image.fill;
- image.setAttribute("src", image.getAttribute("src").replace("_off.", "_on."));
- });
- el.vml.image.shape.attachEvent('onmouseleave', function() {
- var image = el.vml.image.fill;
- image.setAttribute("src", image.getAttribute("src").replace("_on.", "_off."));
- });
- }
- };
- DD_belatedPNG.fix('img');
- }
- // Rollover(Swap)
- jQuery('.hover').hover(function(){
- jQuery(this).attr('src', this.src.replace('_off', '_on'));
- }, function(){
- jQuery(this).attr('src', this.src.replace('_on', '_off'));
- });
- // Fade
- jQuery('.fade').hover(function(){
- jQuery(this).fadeTo(FADE_DURATION, 0.8);
- }, function(){
- jQuery(this).fadeTo(FADE_DURATION, 1.0);
- });
- // Smooth scrolling
- jQuery('a[href*=#]').click(function(){
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
- var $target = jQuery(this.hash);
- $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
- if ($target.length) {
- var targetOffset = $target.offset().top;
- jQuery('html,body').animate({ scrollTop: targetOffset }, SCROLL_VELOCITY, SCROLL_EFFECT);
- return false;
- }
- }
- });
- });
Add Comment
Please, Sign In to add comment