$(".gallery__item div").on({
mouseenter: function () {
$(this).text($(this).data('text'));
},
mouseleave: function () {
$(this).text("");
}
});
$doc = $modx->getObject('modResource', 15); // Получили объект ресурса с ID, например, 15
$migx_value = json_decode($doc->getTVValue('your_tv'), true); // получили значение TV и перекодировали из JSON в массив
{set $val = $_modx->resource.my_tv | json_decode : true}
// Любые операции, например, перебор
{foreach $val as $item}
<p>{$item.title}</p>
{/foreach}
switch ($action) {
case 'firstAction' :
$class->firstMethod();
break;
case 'secondAction' :
$class->secondMethod();
break;
}
[[!yourSnippet? &action = 'firstAction']]
{'!yourSnippet' | snippet : ['action' => 'firstAction']}
$('.gallery').each(function() { // the containers for all your galleries
$(this).magnificPopup({
delegate: 'a', // the selector for gallery item
type: 'image',
gallery: {
enabled:true
}
});
});
$( ".selector" ).on( "slidechange", function( event, ui ) {
var result = parseInt(ui.value) * 10; // Получили значение, умножили
$('.result').text(result); // Записали значение
});
$counter = 0; // Счётчик скачиваний
$id = $modx->resource->get('id'); // Получили ID текущей страницы
$res = $modx->getObject('modResource', $id); // Получили объект страницы
$res->setTVValue('tv_name', $counter + 1); // Записали значение счетчик + 1 в TV "tv_name"
$res->save(); // Сохранили ресурс