[更新]增加图文选择器

This commit is contained in:
Anyon 2017-05-12 19:11:07 +08:00
parent 9b5756e7d7
commit 981670fd7a

View File

@ -40,25 +40,23 @@
{block name="script"}
<script>
require(['jquery'], function () {
require(['jquery.masonry'], function (Masonry) {
var container = document.querySelector('#news_box');
var msnry = new Masonry(container, {itemSelector: '.news_item', columnWidth: 0});
msnry.layout();
/* 事件处理 */
$('.news-container').on('mouseenter', '.news-box', function () {
$(this).addClass('active');
}).on('mouseleave', '.news-box', function () {
$(this).removeClass('active');
});
var seletor = '[name="{$Think.get.field|decode|default=0}"]';
if (seletor) {
$('[data-news-id]').on('click', function () {
window.top.$(seletor).val($(this).attr('data-news-id')).trigger('change');
parent.layer.close(parent.layer.getFrameIndex(window.name))
});
}
require(['jquery.masonry'], function (Masonry) {
var container = document.querySelector('#news_box');
var msnry = new Masonry(container, {itemSelector: '.news_item', columnWidth: 0});
msnry.layout();
/* 事件处理 */
$('.news-container').on('mouseenter', '.news-box', function () {
$(this).addClass('active');
}).on('mouseleave', '.news-box', function () {
$(this).removeClass('active');
});
var seletor = '[name="{$Think.get.field|decode|default=0}"]';
if (seletor) {
$('[data-news-id]').on('click', function () {
window.top.$(seletor).val($(this).attr('data-news-id')).trigger('change');
parent.layer.close(parent.layer.getFrameIndex(window.name))
});
}
});
</script>
{/block}