[更新]增加图文选择器

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"} {block name="script"}
<script> <script>
require(['jquery'], function () { require(['jquery.masonry'], function (Masonry) {
require(['jquery.masonry'], function (Masonry) { var container = document.querySelector('#news_box');
var container = document.querySelector('#news_box'); var msnry = new Masonry(container, {itemSelector: '.news_item', columnWidth: 0});
var msnry = new Masonry(container, {itemSelector: '.news_item', columnWidth: 0}); msnry.layout();
msnry.layout(); /* 事件处理 */
/* 事件处理 */ $('.news-container').on('mouseenter', '.news-box', function () {
$('.news-container').on('mouseenter', '.news-box', function () { $(this).addClass('active');
$(this).addClass('active'); }).on('mouseleave', '.news-box', function () {
}).on('mouseleave', '.news-box', function () { $(this).removeClass('active');
$(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))
});
}
}); });
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> </script>
{/block} {/block}