Register with your Envato account

Support forums

Homepage Support Goliath HTML Template Add Trending (#newsticker) items via ajax calls

Add Trending (#newsticker) items via ajax calls

Homepage Support Goliath HTML Template Add Trending (#newsticker) items via ajax calls

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3612
    jonprasetyo
    Participant

    I am talking about the trending item that is at the very top of the template. (#newsticker)

    I am trying to add li trending items via ajax calls instead of rendering on the spot. However the only way to make it actually animate is to have ajax call async: false. But when i change async into true (which is what i want) the rolling animation does not work 🙁

    How can we fix this?

    $.ajax({
        url: "/ajax/quick_news",
        type: "GET",
        async: false
    }).done(function(yellow){
        yellow.forEach(function(foo){
            $("#newsticker").append('<li class="item"><a href="goliath-post-1.html">'+foo.news+'</a><span class="legend-default"><i class="fa fa-clock-o"></i>March 18, 2015</span></li>')
        })
    });
    #3633

    Hey,

    If you set “async” to FALSE then the ajax request is processed in parallel with other JavaScript Code execution. This results with block update before the the slider is initialized in “goliath.js” file, “initNewsTicker” function. If you set the value to TRUE, it means that block slider is initialized and then the updates are added to the block. So you need to re-initialize it again. Probably you can try just to add call to the “initNewsTicker” function in your code.

    #3648
    jonprasetyo
    Participant

    So I made some changes according to your comment but it is still not working (no errors in the console as well). Is it possible that you can have a code example? Thank you.

    $.ajax({
        url: "/ajax/quick_news",
        type: "GET",
    }).done(function(yellow){
        yellow.forEach(function(tag){
            $("#newsticker").append('<li class="item"><a href="'+tag.link+'">'+tag.news+'</a><span class="legend-default"><i class="fa fa-clock-o"></i>'+tag.posted_at+'</span></li>')
        })
        theme.initNewsTicker()
    });
    #3662

    I can’t help you with this as it will require custom coding from my side and this doesn’t have any relation with template default functionality. All i can’t tell you is that after last content update it should be re-initialized in JavaScript and how you will handle this is up to you.

Viewing 4 posts - 1 through 4 (of 4 total)
You must have active support license to create new replies.

Learn more about Renewing Item Support and Themeforest Item Support Policy.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close