I'm trying to use Flexslider from within my module. Given that I've created an optionset called 'spotlight' and the following HTML:
<div class="spotlight">
<ul>
<li><img src="" alt="" /></li>
<li><img src="" alt="" /></li>
<li><img src="" alt="" /></li>
</ul>
</div>
How do I enable Flexslider? I tried:
<?php
flexslider_add('spotlight', flexslider_optionset_load('spotlight'));
?>
but this doesn't work. It took me a while to figure out that flexslider expects a optionset as Object instead of a string as the documentation suggests. And that ID (although the function accepts NULL), needs to be set even if you only need an optionset. I'd expect the module to work without ID, as I prefer using classes in my HTML instead of ID's. But if this is needed, can you please explain how my HTML should look and how I can load the Flexslider?
Thanks a lot!
Comments
Comment #1
minorOffense CreditAttribution: minorOffense commentedActually you found half a bug in there. The function should accept a string or the loaded object. (I'll fix that).
The ID is in case of multiple sliders on the same page. But you can always initialize the slider in your own javascript by first calling
And in your theme or js files include something like
Comment #2
minorOffense CreditAttribution: minorOffense commentedI'll consider for v2 to have the element identifier be type agnostic (i.e. classes or ids or whatever).
Comment #3
minorOffense CreditAttribution: minorOffense commentedFixed in latest commit for v2.
Comment #4
minorOffense CreditAttribution: minorOffense commentedComment #5
tirdadc CreditAttribution: tirdadc commentedI'm trying the approach suggested in #1 but it's ignoring all the flexslider settings in the default profile.
Comment #6
minorOffense CreditAttribution: minorOffense commentedSadly I haven't had time to fix this in 1.x and I don't think I'll end up doing so. 2.x is stable enough to migrate to.