# j-AutoSelect

> Komponent automatycznie dodaje klasę .wybrana według klasy selektora="autoselect" w całym dokumencie HTML.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: pl
Content-SHA256: 606d0d026b1e6ff2ac713f3a4e114c35c3c444e30cb77b05984515548d96b634
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- Singleton

Komponent automatycznie dodaje klasę `.selected` według selektora `class="autoselect"` w całym dokumencie HTML. Komponent ten jest doskonałym rozwiązaniem do renderowania serwera i późniejszej podkreślenia.

__Konfiguracja__:

- `selector {String}` to wybór jQuery (default: `.autoselect a`)
- `class {String}` to nazwa klasy dla wybranego elementu (default: `selected`)

Użyj go z `<ui-component name="autoselect">`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.

```html example.html
<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="autoselect" path="NAV.url"></ui-component>

<div class="links autoselect">
	<div class="m">Menu 1</div>
	<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>
</div>
<br />
<div class="links autoselect">
	<div class="m">Menu 2</div>
	<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>
</div>

<script>

	var arr = ['/', '/products/', '/settings/'];

	setInterval(function() {
		REDIRECT(arr[(Math.random() * arr.length) >> 0]);
	}, 1500);

</script>
```
