j-ASelected
- readonnie
Komponent dodaje klasę selected do elementu <a jeśli atrybut href zawiera adres URL z przeglądarki internetowej.
Konfiguracja:
class {String}to nazwa klasy dla wybranego elementu (default:selected)selector {String}to wybór jQuery (default:a)- Wskaźnik
attr {String}do porównania (default:href) strict {Boolean}umożliwia ściśle porównywanie adresów URL (default:false)delay {Number}- opóźnienie w ponownym odbiciu przy zmianie modelu (default:300)- NEW:
watch {String}- ścieżka do obserwacji zmian
Użyj go z <ui-component name="aselected">Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu DEF.fallback (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.
<style>
.links a { display: block; border: 0; text-align: left; color: gray; font-size: 14px; border-radius: 2px; padding: 2px 10px; margin-bottom: 1px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; position: relative; }
.links a i { width: 14px; text-align: center; font-size: 12px; margin-right: 7px; color: #4285F4; }
.links .selected { font-weight: bold; color: white !important; background-color: #4285F4; }
.links .selected i { color: white !important }
.links a:hover { text-decoration: none; color: black; }
</style>
<ui-component name="aselected" class="links">
<a href="/"><i class="ti ti-users"></i>Users</a>
<a href="/products/"><i class="ti ti-box"></i>Products</a>
<a href="/settings/"><i class="ti ti-cog"></i>Settings</a>
</ui-component>
<script>
var arr = ['/', '/products/', '/settings/'];
setInterval(function() {
REDIRECT(arr[(Math.random() * arr.length) >> 0]);
}, 1500);
</script>