CanaryNoir
9/24/2014 - 7:45 PM

link in new window

link in new window

$('#imagelink').click(function() {
    var URL = $.myURL("index", $(this).attr("href"));
    window.open(URL,'_blank','',''); 
});

// open links in new window  
      $("a[href^='http']:not([href*='sauweb.org'])").attr("target","_blank");
      $('a').click(function() {
          var iHref = $(this).attr('href');
          if ((iHref.indexOf("images/") !== -1) || (iHref.indexOf("docs/") !== -1) || (iHref.indexOf("getattachment") !== -1) || (iHref.indexOf(".pdf") !== -1)) {
              window.open(this.href);return false;
          }
      });
  
  // smooth scrolling
    function scrollToAnchor(aid){
      var aTag = $("a[name='"+ aid +"']").offset();
      if (aid !== "" && aid.indexOf(".") === -1 && aid.indexOf("javascript:;") === -1) {
        $('html,body').animate({scrollTop: aTag.top},'slow');
      }
    }
    
    $("[href*='#']").click(function() {
      var href = $(this).attr('href').replace('#', '');
      scrollToAnchor(href);
    });
  });