# j-ASelected

> Компонентът добавя избрания клас към елемент, ако атрибутът href на елемента съдържа URL адрес от уеб браузъра.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: bg
Content-SHA256: 699016db16a9e05203ab5a10088e06d9c12f956e8f94f461ffeb71cd5fcd7728
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- четене

Съставът добавя `selected` Класа на `<a` Елементът, ако `href` Атрибутът на елемента ще съдържа URL адрес от уеб браузъра.

__Конфигуриране__:

- `class {String}` е класно име за избрания елемент (предварително: `selected`)
- `selector {String}` е jQuery селектор (предварително: `a`)
- Атрибут на `attr {String}` за сравнение (предварително: `href`)
- `strict {Boolean}` позволява стриктно сравняване на URL адресите (предварително: `false`)
- `delay {Number}` за отлагане на подбора, когато моделът се променя (предварително: `300`)
- __NEW__: `watch {String}` е пътят за наблюдение на промените

Използвайте го с `<ui-component name="aselected">`Когато компонентът все още не е зареден, jComponent Изтегляне на първия адрес в `DEF.fallback` (След това Componentator Източник: Питър Шерка Componentator Съставни съставки, лиценз на 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="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>
```
