var query = location.href.split('#'); jQuery(document).ready(function($) { $(window).scroll(function () { if ($(this).scrollTop() != 0) { $('#toTop').fadeIn(); } else { $('#toTop').fadeOut(); } }); $('#toTop').click(function () { $('body,html').animate({ scrollTop: 0 }, 800); }); $('#menu li') // remove the 'highlight' class from the li therefore stripping // the :hover rule .removeClass('highlight') // within the context of the li element, find the a elements .find('a') // create our new span.hover and loop through anchor: .append('').each(function () { // cache a copy of the span, at the same time changing the opacity // to zero in preparation of the page being loaded var $span = $('> span.hover', this).css('opacity', 0); // when the user hovers in and out of the anchor $(this).hover(function () { // on hover // stop any animations currently running, and fade to opacity: 1 $span.stop().fadeTo(500, 1); }, function () { // off hover // again, stop any animations currently running, and fade out $span.stop().fadeTo(500, 0); }); }); $('.portfoliobg') // remove the 'highlight' class from the li therefore stripping // the :hover rule .removeClass('highlight') // within the context of the li element, find the a elements .find('a') // create our new span.hover and loop through anchor: .append('').each(function () { // cache a copy of the span, at the same time changing the opacity // to zero in preparation of the page being loaded var $span = $('> span.hover', this).css('opacity', 0); // when the user hovers in and out of the anchor $(this).hover(function () { // on hover // stop any animations currently running, and fade to opacity: 1 $span.stop().fadeTo(300, 1); }, function () { // off hover // again, stop any animations currently running, and fade out $span.stop().fadeTo(750, 0); }); }); /* Fancybox */ $("a.fancypopup").fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 300, 'speedOut' : 200, 'overlayOpacity' : 0.85, 'scrolling' : false, 'centerOnScroll' : true, 'width' : 940, 'overlayColor' : '#0b191f' }); $("#" + query[1]).trigger('click'); });