简体   繁体   English

使用JavaScript加载内容的Flexslider

[英]Flexslider with content loaded using JavaScript

I'm loading the content using: 我正在使用以下内容加载内容:

jQuery('slides').html(slides);

I'm using this slider http://flexslider.woothemes.com/ . 我正在使用此滑块http://flexslider.woothemes.com/ Here is the question. 这是问题。 How can I load this slider when the slides in the HTML structure will be added? 当将添加HTML结构中的幻灯片时,如何加载此滑块?

All works well when I enter to my website using direct link - then the content is loaded automatically. 当我使用直接链接进入我的网站时,一切都很好-然后内容会自动加载。 I have a problem when I load a "subpage" using jQuery, then slider doesn't work. 我在使用jQuery加载“子页面”时遇到问题,然后滑块不起作用。

I tried to add: 我尝试添加:

 $('#carousel').flexslider({
    animation: "slide",
    controlNav: false,
    animationLoop: false,
    slideshow: false,
    itemWidth: 210,
    itemMargin: 5,
    asNavFor: '#slider'
  });

  $('#slider').flexslider({
    animation: "slide",
    controlNav: false,
    animationLoop: false,
    slideshow: false,
    sync: "#carousel"
  });

after jQuery('slides').html(slides); jQuery('slides').html(slides); , but it doesn't work. ,但无效。

Thanks! 谢谢!

'slides' isn't a tag name so that last part wouldn't work. 'slides'不是标签名称,因此最后一部分将不起作用。 Try making that selector actually work, like by using $('#slides') 尝试使选择器真正起作用,例如使用$('#slides')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM