Forums

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

Home Forums JavaScript Two functions – Work individually, not together!

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

    The following problem relates to this page:
    http://www.burndenaces.co.uk/rumourmill

    On the right hand side of the page, there are a series of images that scroll through using the innerfade function.

    Code:
    $(document).ready(
    function(){
    $(‘.fader’).innerfade({
    animationtype: ‘fade’,
    speed: 3000,
    timeout: 8000,
    type: ‘sequence’,
    containerheight: ‘294px’
    });
    }
    );

    However, I am trying to get the page to refresh automatically every so often through AJAX using this code:

    Code:
    function getFresh() {
    $(“#rumourmill”).load(“rumourmill.php”)
    };

    $(function(){
    getFresh();
    var int = setInterval(“getFresh()”, 15000);
    });

    Both of these work fine indivually but when I try to use both, the innerfade stops working. I’ve tried messing around but in truth, I’m just stuck on what to do next in order to get them both working together.

    I came up with this, but it was just guess work and doesn’t work:

    Code:
    function getFresh() {
    $(“#rumourmill”).fadeOut(400, function() {
    $(“#rumourmill”).load(“rumourmill.php”, function() {
    $(“#rumourmill”).fadeIn();
    });
    });
    };

    function getinnerFade() {
    $(‘.fader’).innerfade({
    animationtype: ‘fade’,
    speed: 3000,
    timeout: 8000,
    type: ‘sequence’,
    containerheight: ‘294px’
    });
    };

    $(function(){
    getFresh();
    var int = setInterval(“getFresh()”, 15000);

    getinnerFade();
    });

    Does anyone know where I’m going wrong and needs doing to fix it? Thanks.

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.