select *
from dialog_users as d1
where
user_id = 1 -- первый юзер
and
(select dialog_id
from dialog_users as d2
where d2.user_id = 2 -- второй юзер
and d2.dialog_id = d1.dialog_id)
and
(select count(*)
from dialog_users as d3
where d3.dialog_id = d1.dialog_id) = 2 -- количество человек в диалоге
var margin = 15; // 15px отступ для наглядности
$('.container').on('resize scroll', function() {
var $container = $(this);
var container_height = $container.outerHeight();
$('.block').each(function(i, block) {
var $block = $(block);
var top = $block.offset().top - $container.offset().top;
var bottom = top + $block.outerHeight();
var is_visible = (bottom > (0 + margin) && top < (container_height - margin));
$block[is_visible ? 'addClass' : 'removeClass']('block-visible');
});
}).trigger('scroll');
.block-visible { background-color: red; }
position: absolute
. .slogan {
color: #fff;
font-size: 28px;
display:block;
width: 100%;
text-align:center;
position:absolute;
}
const elements = document.querySelectorAll('p');
const attrNamePrefix = 'bind:';
const result = Array.prototype.filter.call(
elements,
n => Array.prototype.some.call(
n.attributes,
m => m.name.startsWith(attrNamePrefix)
)
);
const result = [];
for (const n of elements) {
for (const m of n.attributes) {
if (m.name.indexOf(attrNamePrefix) === 0) {
result.push(n);
break;
}
}
}