How to implement jScroll?

前端 未结 1 1226
挽巷
挽巷 2021-02-20 09:55

Im a beginner in JS & jQuery so please bear with me.

Im trying to create a dynamic list

    using JS and finally its working. Now i need to imple
1条回答
  •  故里飘歌
    2021-02-20 10:36

    You hava every thing prety much set just needed to call jscroll at proper time.

    $.ajax({
            url: "http://localhost/jwmws/index.php/jwm/search/msmall/"+keyword, //This is the current doc
            type: "GET",
            error : function(jq, st, err) {
                alert(st + " : " + err);
            },
            success: function(result){
                //generate search result
                //float:left untuk hack design
                $('#search').append('

    Search for : ' + keyword + '

    ' + '
    ' + '

    Found ' + result.length + ' results

    '); if(result.length == 0) { //temp alert("not found"); } else{ for(var i = 0; i < result.length; i++) { //generate
  • $('#list').append('
  • Name

    Address

  • '); } //After generation of
  • put a next link $('#list').append('NEXT'); //call to jscroller to be triggered jscroller(); var i=0; $(".box").each(function(){ var name, address, picture = ""; if(i < result.length) { name = result[i].name; address = result[i].address; picture = result[i].boxpicture; } $(this).find(".name").html(name); $(this).find(".address").html(address); $(this).find(".picture").attr("src", picture); i++; }); } } }); //The function to be called when
  • are rendered. function jscroller(){ $('.infinite-scroll').jscroll({ loadingHtml: 'Loading Loading...', padding: 20, nextSelector: 'a.jscroll-next:last', contentSelector: 'li' }); }
  • 0 讨论(0)
提交回复
热议问题