Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to stop AJAX from acting on jpg, pdf files etc

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #32570

    I have the following code to ajaxify my wordpress theme. However, it also tries to ajax stuff like jpg’s and pdf’s, meaning they don’t load. How do I stop this?

         // Set up variables
    var base = '',
    $mainContent = $("#container"),
    $allLinks = $("a"),
    $ajaxLoader = $("#ajaxLoader"),
    $el;

    // Detect link clicks
    $('a:urlInternal').live('click', function(e) {
    $el = $(this);
    if ((!$el.hasClass("comment-reply-link")) && ($el.attr("id") != 'cancel-comment-reply-link') && ($el.attr("id") != 'contactSidebarLink')) {
    var path = $(this).attr('href').replace(base, '');
    $.address.value(path);
    return false;
    }
    e.preventDefault();
    });


    // Actual AJAX stuff
    $.address.change(function(event) {
    var extension = (event.value).substr((event.value).lastIndexOf('.') +1);
    if ((event.value) && ((event.value) != '/contactPopup') && extension != 'jpg') {
    $("#bg").fullBg();
    $ajaxLoader.fadeIn();
    $mainContent.fadeOut().empty().load(base + event.value + ' #container', function() {
    $ajaxLoader.fadeOut(function() {
    $("#bg").fullBg(); // Resize Background
    var currentPosition = 0,
    slideWidth = 500,
    slides = $('.slide'),
    numberOfSlides = slides.length;
Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.