Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax load multiple divs (WordPress)
    primarykey
    data
    text
    <p>I'm using a ajax script to load content from other pages, without having to reload the browser. </p> <p>For now I'm retrieving the content of the #inside div, but I'm using a full-background slideshow (#full) wich needs to be loaded as wel.</p> <p>Maybe this can be achieved by loading the content of the #full div also, but I don't know how I could do that. </p> <p>This is my code:</p> <pre><code> // Self-Executing Anonymous Function to avoid more globals (function() { // Home link isn't dynamic, so default set class name to it to match how dynamic classes work in WordPress $(".home li.home").removeClass("home").addClass("current_page_item"); // Add spinner via JS, cuz would never need it otherweise $("body").append("&lt;img src='http://themeclubhouse.digwp.com/images/ajax-loader.gif' id='ajax-loader' /&gt;"); var $mainContent = $("#wrapper"), $ajaxSpinner = $("#ajax-loader"), $searchInput = $("#s"), $allLinks = $("a"), $el; // Auto-clear search field $searchInput.focus(function() { if ($(this).val() == "Search...") { $(this).val(""); } }); $('a:urlInternal').live('click', function(e) { // Caching $el = $(this); if ((!$el.hasClass("comment-reply-link")) &amp;&amp; ($el.attr("id") != 'cancel-comment-reply-link')) { var path = $(this).attr('href').replace(base, ''); $.address.value(path); $(".current_page_item").removeClass("current_page_item"); $allLinks.removeClass("current_link"); $el.addClass("current_link").parent().addClass("current_page_item"); return false; } // Default action (go to link) prevented for comment-related links (which use onclick attributes) e.preventDefault(); }); // Fancy ALL AJAX Stuff $.address.change(function(event) { if (event.value) { $ajaxSpinner.fadeIn(); $mainContent .empty() .load(base + event.value + ' #content', function() { $ajaxSpinner.fadeOut(); $mainContent.fadeIn(); }); } var current = location.protocol + '//' + location.hostname + location.pathname; if (base + '/' != current) { var diff = current.replace(base, ''); location = base + '/#' + diff; } }); })(); // End SEAF </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload