Jquery help ekak

chaturanga836

Well-known member
  • Aug 12, 2015
    3,353
    1,307
    113
    Malabe
    Yes, eka karanda puluwan.

    eth, mama dakka, tutorial ekaka ehema nokara same data variable haraha, multiple arguiments sent karanawa. habai eka wordpress friendly widihata liyala thiyenne, php components.


    Jquery plugin ekai script ekai thama wadey , karanne out put karana data use karala.

    me thiyenne mama examine karapu eke, git hub link eka.
    https://github.com/apurbajnu/barfiller-vc-extension

    eke script eke, me wage foreach function ekak thama multiple arrays handle karanne.

    Code:
    (function ($) {     $(document).ready(function(){          var barfill = $(".barfill-container");         if(barfill.length>0){             barfill.each(function(){                 options = $(this).data('options');                 console.log(options);                  $(this).barfiller(options);             })         }      }); })(jQuery)
    me widihe method ekak use karala, same code repeat karana eka adu karandai baluwe.


    $(".barfill-container"); meka class ekakin element eka call karanne ethakota reuturn wenne object array ekk

    oya php walin data set karoth menna me widihata


    <?php foreach($data as $atts): ?>

    <div class="barfill-container" data-options='{"barColor":"<?php echo $atts['color']; ?>","duration":"<?php echo $atts['duration']; ?>","tooltip":"<?php echo $atts['tooltip']; ?>"}'>
    <h3><?php echo $atts['title']; ?></h3>

    <div id="bar" class="barfiller" >
    <div class="tipWrap">
    <span class="tip"></span>
    </div>
    <span class="fill" data-percentage="<?php echo $atts['parcent']; ?>"></span>
    </div>

    </div>

    <?php endforeach; ?>


    oyata javascrip wala foreach eka haraka data access karanna puluwan.