Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for data-raty-* options #197

Open
deleugpn opened this issue Dec 9, 2016 · 1 comment
Open

Support for data-raty-* options #197

deleugpn opened this issue Dec 9, 2016 · 1 comment

Comments

@deleugpn
Copy link

deleugpn commented Dec 9, 2016

Is it possible or is there any plan for supporting in-html attribute?

Instead of

jQuery('.ticket-raty').raty({
    starOff: 'img/raty/star-off.png'
});

we would be able to do

<div class="ticket-raty" data-raty-star-on="img/raty/star-on.png"></div>

And thus focusing more on pure HTML + library as oppose to HTML + JS + Library.

@arturmamedov
Copy link

Here the pull request #168

If you want you can costumize youron code like this:

// #jQuery.plugin - raty for a star rating view
    if ($().raty) {
        $('.getraty').each(function () {
            // startype = i
            var startype = $(this).data('startype');
            if (typeof startype == 'undefined' || startype.length == 0)
                startype = 'i';

            // readonly = true
            var readonly = $(this).data('readonly');
            if (typeof readonly == 'undefined' || readonly.length == 0)
                readonly = true;

            // score = 5
            var score = $(this).data('readonly');
            if (typeof score == 'undefined' || score.length == 0)
                score = 5;

            $(this).raty({starType: startype, readOnly: readonly, score: score});
        });
    } // END - #jQuery.raty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants