stevenwanderski / bxslider-4

Responsive jQuery content slider
Other
4.22k stars 1.85k forks source link

Feature request - data-attributes #172

Open jasonday opened 11 years ago

jasonday commented 11 years ago

As part of a feature request, I'd like to see bxslider make use of data-attributes to drive functionality, so that the initiating function does not have to be explicitly called.

Examples include twitter bootstrap or cycle2:

<div class="cycle-slideshow" data-cycle-speed="600" data-cycle-manual-speed="100"> ...
mw-ph commented 11 years ago

Actually one of the reasons I choose to use bxSlider is because there isn't an over-reliance on them, they validate incorrectly in HTML 4.0 compared to other sliders out there that made me want to do one myself. Very grateful of the current purpose in the design as it is. "data-attributes" are not something I would want more of.

jasonday commented 11 years ago

@mw-ph - the beauty of data-attributes is that you could make a choice to use them or not. Data-attributes are a method to interact with the functionality of the plugin, thereby giving you choice. Additionally, I would argue that html4 validity is a weak case for not integrating features into a website considering it was authored in 1999.

mw-ph commented 11 years ago

Strange it seems whenever I encounter Data-attributes they are essentially mandatory to the operation. :/ I'd love to work with HTML5 24/7, sadly some clients want what they want and can't be persuaded. I'm relatively new to jQuery I can just about bodge stuff together, but I'm starting to get more confident and be picky. I've got about a 12 years of XP with HTML/CSS/PHP/SQL so its inevitable really I'd get good with jQuery. Add in my Graphic Design XP I'm finally not going to be reliant on others for bits and piece of UX design. :) Although I might wait awhile to engineer my own slideshow lib.

I found a way to do it ^^ in the end: var slides_total = slider.getSlideCount(); // starts counting at 1 var slide_number = slider.getCurrentSlide(); // an integer, not the html!

I'm even more satisfied with this plugin now. Does more of what I want (even if I can't find how to do it straight away).

Thanks wandoledzep , you've done a great job.

birdkiwi commented 10 years ago

Yes, data attributes is great feature. Sometimes it helps when you use sliders in CMS modules with configurable settings. Please, add this feature ;)

macedd commented 10 years ago

CMS and any templatable system. Data attributes would allow a single bxSlider call

$('.bxslider').bxSlider();

To make any slider on page work with its own options

<ul class="bxslider" data-speed="1200">
  <li><img src="/images/pic1.jpg" /></li>
  <li><img src="/images/pic2.jpg" /></li>
</ul>

<ul class="bxslider" data-speed="500" data-easing="ease-in-out">
  <li><img src="/images/pic1.jpg" /></li>
  <li><img src="/images/pic2.jpg" /></li>

</ul>
zlove commented 10 years ago

I made a wrapper for bxSlider that does this. Check it out here:

https://gist.github.com/zlove/eb95e9d51af5b55eb435

Tidal-Wave commented 9 years ago

Hey folks, i've been added to the project to help maintain it and provide updates. I agree that using data attributes has a ton of uses, and we would like to incorporate this in our update path. We will be reviewing the code provided by @zlove and looking at how to quickly get this into bxSlider. We will shoot for our 4.2 update, but since we have a lot of outstanding bugs to look at it might get pushed to a 4.2.* or 4.3 update.

zlove commented 9 years ago

Hi Eric,

Thanks for the update. Glad to hear that you will maintaining bxSlider, and I hope the data attributes make it in. I've been using data attributes via my hack, and they are really handy.

On Mon, Jan 19, 2015 at 11:20 AM, Eric Wafford notifications@github.com wrote:

Hey folks, i've been added to the project to help maintain it and provide updates. I agree that using data attributes has a ton of uses, and we would like to incorporate this in our update path. We will be reviewing the code provided by @zlove https://github.com/zlove and looking at how to quickly get this into bxSlider. We will shoot for our 4.2 update, but since we have a lot of outstanding bugs to look at it might get pushed to a 4.2.* or 4.3 update.

— Reply to this email directly or view it on GitHub https://github.com/stevenwanderski/bxslider-4/issues/172#issuecomment-70537986 .

Tidal-Wave commented 9 years ago

They definitely will, we just got to clear out the clutter so we can see the horizon.

ratron commented 6 years ago

will Zach's approach https://gist.github.com/zlove/eb95e9d51af5b55eb435 find it's way into the main branch? there was a bug with multiple sliders on one page with his code that i fixed in a comment to the gist.