This is probably a simply Jscript question... but i don't know Jscript and am just hacking about using code very usefully posted on this site...
I'm trying to create a news feed widget for specified forums but want to ignore the announcements as they appear in every forum. So far i have:
jQuery("#newsareal1").load("/f28-dig-finds div.topic-title-container:lt( 8 )");
... so it selects the first eight posts from the dig finds forum... but the first ones are always the announcements!
I can change :lt( 8 ) to be :gt(3):lt(11); so it skips the first 3 and shows the next 8 but i would have to change the code every time the number of announcements changed... so not a realistic option.
I think i can add a .filter() before the .load but I don't know what to put in it... or if this is the right thing to do (should i add a :not() after the :lt() instead for instance?).
For completeness:
The widget for the portal contains:
<h3>Dig Finds</h3>
<div id="newsareal1" class="newsareal"></div>
<h3>Rally Finds</h3>
<div id="newsareal2" class="newsareal"></div>
<h3>Finds ID</h3>
<div id="newsareal3" class="newsareal"></div>
The javascript currently has:
jQuery(document).ready(function(){
jQuery("#newsareal1").load("/f28-dig-finds div.topic-title-container:lt( 8 )");
jQuery("#newsareal2").load("/f27-rally-finds div.topic-title-container:lt( 8 )");
jQuery("#newsareal3").load("/f7-id-your-finds-with-mick-paul- div.topic-title-container:lt( 8 )");
});
Thanks for your help.
I'm trying to create a news feed widget for specified forums but want to ignore the announcements as they appear in every forum. So far i have:
jQuery("#newsareal1").load("/f28-dig-finds div.topic-title-container:lt( 8 )");
... so it selects the first eight posts from the dig finds forum... but the first ones are always the announcements!
I can change :lt( 8 ) to be :gt(3):lt(11); so it skips the first 3 and shows the next 8 but i would have to change the code every time the number of announcements changed... so not a realistic option.
I think i can add a .filter() before the .load but I don't know what to put in it... or if this is the right thing to do (should i add a :not() after the :lt() instead for instance?).
For completeness:
The widget for the portal contains:
<h3>Dig Finds</h3>
<div id="newsareal1" class="newsareal"></div>
<h3>Rally Finds</h3>
<div id="newsareal2" class="newsareal"></div>
<h3>Finds ID</h3>
<div id="newsareal3" class="newsareal"></div>
The javascript currently has:
jQuery(document).ready(function(){
jQuery("#newsareal1").load("/f28-dig-finds div.topic-title-container:lt( 8 )");
jQuery("#newsareal2").load("/f27-rally-finds div.topic-title-container:lt( 8 )");
jQuery("#newsareal3").load("/f7-id-your-finds-with-mick-paul- div.topic-title-container:lt( 8 )");
});
Thanks for your help.
Last edited by Mark T on April 14th 2014, 8:28 am; edited 2 times in total (Reason for editing : stoopid smilies auto inserting...)