Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • jooservices Friend
    #683596

    This topic is not about copy & paste content. I’ll try explain how does this tools work than you can implement or modify it as your needed.

    <li data-fss="Smaller,Small,Medium,Big,Bigger">
    <a class="btn" href="#" title="Smaller Font" data-value="-1" data-target=".article" data-action="nextPrev" data-key="fs"><i class="fa fa-minus"></i></a>
    <strong>Medium</strong>
    <a class="btn" href="#" title="Bigger Font" data-value="+1" data-target=".article" data-action="nextPrev" data-key="fs" data-default="Medium"><i class="fa fa-plus"></i></a>
    </li>

    templatesja_teline_vjsscript.js

    // next-prev actions tool
    jActions.nextPrev = function ($btn) {
    var action = $btn.data('action'),
    target = $btn.data('target'),
    prop = $btn.data('key'),
    value = parseInt($btn.data('value')),
    $target = $btn.parents(target),
    values = $btn.parent().data(prop + 's').split(','),
    curVal = $.cookie(action + '-' + prop),
    curValIdx = $.inArray(curVal, values),
    newValIdx = curValIdx + value;
    if (!$target.length) $target = $(target);
    if (!$btn.parent().data('loop') && (newValIdx < 0 || newValIdx >= values.length)) {
    return ;
    }
    newValIdx = newValIdx < 0 ? values.length-1 : (newValIdx >= values.length ? 0 : newValIdx);
    if (newValIdx != curValIdx) {
    $target.removeClass(prop + '-' + curVal.replace(' ', '-').toLowerCase()).addClass(prop + '-' + values[newValIdx].replace(' ', '-').toLowerCase());
    if ($btn.data('cookie') != 'no') $.cookie(action + '-' + prop, values[newValIdx], {path: '/'});
    $btn.parent().find ('strong').html (values[newValIdx]);
    }
    };

    In basic it’ll do
    – Split fss “Smaller,Small,Medium,Big,Bigger” into array
    – Use that and apply class ( defined in data-target )

    <article class="article font-default fs-medium" itemscope="" itemtype="http://schema.org/Article">

    In css define code for these class.

    For sample

    .fs-big {
    font-size: 18px;
    }

    So if you wan change it into your language.
    – Change fss value
    – Update css for new class names.

    That’s all.

    But in general css class should not use local language. Specially none standard characters.

    Thank you,
    Viet Vu

    franci Friend
    #903422

    – Split fss “Smaller,Small,Medium,Big,Bigger” into array

    How can I split this into array?

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 1 reply, has 2 voices, and was last updated by  franci 8 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum