Git Product home page Git Product logo

Comments (3)

cletter7 avatar cletter7 commented on August 14, 2024

I think the problem appears because you generate HTML asynchronously, so you run the lbSlider before the HTML has already generated. You should run lbSlider in callback function after HTML is generated.

from lbslider.

AddiJamshidi1 avatar AddiJamshidi1 commented on August 14, 2024

Thank you... Actually I figured out what the issue was..
I was building the HTML snippet dynamically and everytime a tag was generated I would use the append method of the element property of the $widget to build the HTML. THe problem was when appending for example the UL tag, the append method automatically also would add the closing tag as well, and hence the LI elements never ended up being the children of the UL element.
e.g. I was calling this.element.append(htmlSnippet); where to begin with htmlSnippet was "

    " and hence the append method would automatically add the "</ul"> before getting to generate the "
  • " children.

    The fix is to create the HTML snippet string, in its entirety and then once everything is generated, call the append method to add it to this.element. The UL element is definitely required and it must have LI children for this to work.

from lbslider.

Developer-Amit avatar Developer-Amit commented on August 14, 2024

Hey I have same problem.... Please view this..
/// This Is Ajax Dynamic HTML Generation Code////////

jQuery.ajax({
url: "http://ec2-52-21-208-137.compute-1.amazonaws.com:5000/api/v1/mobile/videos/" + catname + "/" + appid,
type: "GET",
data: {
'category': catname
},
dataType: 'json',
success: function(response) {
var cat_name = catname.replace(/\s/g, "_");
console.log(cat_name);
var str = "

Previous
    ";
    $.each(response, function(index, val) {
    source = val.isYoutube == true ? 'y-' + val.viemoId : 'v-' + val.viemoId;
    str += "
  • " + val.watchingRewardPoints + " Points
    <a href='#''>" + val.tags + "
    " + val.viewCount + " Views 1 day ago
  • ";
    });
    str += "
Next
";
$("#vm-videolist").append(str);
},
complete: function() {
//console.log('on completed');
},
error: function(xhr) { // if error occured
var str = '
  • Error occured please check category
  • ';
    $('#videos').append(str);
    },
    });

    /////I have make this code for slider/////
    $('#slide_content').slick({
    dots: true,
    infinite: false,
    speed: 300,
    slidesToShow: 4,
    slidesToScroll: 4,
    });

    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js"></script>

    from lbslider.

    Related Issues (5)

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.