Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Functions need to run again after ajax is complete
    primarykey
    data
    text
    <p>I am developing a website that parses rss feeds and displays them based on category. You can view it here: <a href="http://vitaminjdesign.com/adrian" rel="nofollow">http://vitaminjdesign.com/adrian</a></p> <p>I am using tabs to display each category. The tabs use ajax to display a new set of feeds when they are clicked.</p> <p>I am also using two other scripts- One called <a href="http://www.cssnewbie.com/equal-height-columns-with-jquery/" rel="nofollow">equalheights</a>, which re-sizes all of the heights to that of the tallest item. And the other script I am using is called <a href="http://www.sohtanaka.com/web-design/smart-columns-w-css-jquery/" rel="nofollow">smart columns</a>, which basically resize your columns so it always fills the screen.</p> <p>The first problem I am having is when you click a new tab (to display feeds within that category). When a new tab is clicked, the console shows a jQuery error:</p> <pre><code>$(".block").equalHeights is not a function [Break On This Error] $(".block").equalHeights(); </code></pre> <p>The main problem is that each feed box fills up the entire screen's width (after you click on a tab), even if there are multiple feed boxes in that category.</p> <p>MY GUESS - although all of the feeds (across all tabs) are loaded on pageload, when a new tab is selected, both jQuery scripts need to be run again. any ideas on how I can make this work properly?</p> <p>One thing to note - I used the ajaxSuccess method for making equalHeights work on the first page...but it wont work after a tab is clicked.</p> <p>My jQuery code for the tabs are below:</p> <pre><code>$(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content $("#cities li:nth-child(1)").addClass('zebra'); $("#column li ul li:nth-child(6)").addClass('zebra1'); //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content $(".block").equalHeights(); return false; }); </code></pre> <p>Thanks to Macy (see answer below), I have brought my jQuery script to the following: (still does not work)</p> <pre><code>$(document).ajaxSuccess(function(){ var script = document.createElement('script'); script.src = 'js/equalHeight.js'; document.body.appendChild(script); equalHeight($(".block")); </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.
 

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