恢复Uikit过滤器

时间:2018-06-15 07:14:05

标签: javascript uikit

update img clicking时如何button图库var btn = document.getElementById('btn'), link = document.querySelectorAll('.uk-subnav.uk-subnav-pill li'); btn.addEventListener('click', function() { console.log('k'); link.forEach(function(elem) { elem.classList.remove('uk-active'); }); document.getElementById('all').classList.add('uk-active'); });

目前我刚刚更新了活动类,但没有设法恢复所有项目。

JS

<button type="button" id="btn" class="uk-button uk-button-secondary uk-position-center" style="top:1.5em;letter-spacing:.5em;">Back to top</button>
        <div uk-filter="target: .js-filter">
            <ul class="uk-subnav uk-subnav-pill">
                <li id="all" class="uk-active" uk-filter-control><a href="#">All</a></li>
                <li uk-filter-control="[data-color='white']"><a href="#">White</a></li>
                <li uk-filter-control="[data-color='blue']"><a href="#">Blue</a></li>
                <li uk-filter-control="[data-color='black']"><a href="#">Black</a></li>
            </ul>
            <ul class="js-filter uk-child-width-1-2 uk-child-width-1-3@m uk-text-center" uk-grid>
                <li data-color="white">
                    <div class="uk-card uk-card-default uk-card-body">Item</div>
                </li>
                <li data-color="blue">
                    <div class="uk-card uk-card-primary uk-card-body">Item</div>
                </li>
                <li data-color="black">
                    <div class="uk-card uk-card-default uk-card-body">Item</div>
                </li>
            </ul>
        </div>

HTML 的一部分:

this.agmMarkers.push({
  lat: +entry.latlng.lat,
  lng: +entry.latlng.lng,
  icn: this.mcar
});

Fiddle

0 个答案:

没有答案