重构代码:FAIcon页面使用ajax调用图标局域视图,利用已经被缓存机制减少网络带宽

This commit is contained in:
Argo-MacBookPro 2018-09-12 22:29:45 +08:00
parent 0dd5ee9db3
commit f83717e724
2 changed files with 19 additions and 9 deletions

View File

@ -9,4 +9,4 @@
@section javascript { @section javascript {
<script src="~/js/icon.js"></script> <script src="~/js/icon.js"></script>
} }
@await Html.PartialAsync("IconView") <div class="text-center"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></div>

View File

@ -1,11 +1,21 @@
$(function () { $(function () {
var $iconList = $('div.fontawesome-icon-list').on('click', 'a', function () { $.bc({
window.console.log($(this).children('i').attr('class')); url: Menu.iconView,
return false; contentType: 'text/html',
dataType: 'html',
callback: function (result) {
if (result) {
$('#main-content').html(result);
var $iconList = $('div.fontawesome-icon-list').on('click', 'a', function () {
window.console.log($(this).children('i').attr('class'));
return false;
});
$iconList.find('ul li').addClass('col-xl-2 col-md-3 col-sm-4 col-6');
$iconList.find('div').addClass('col-xl-2 col-6');
$('#main-content').scrollspy({ offset: 150, target: '.fa-nav' });
}
}
}); });
$iconList.find('ul li').addClass('col-xl-2 col-md-3 col-sm-4 col-6');
$iconList.find('div').addClass('col-xl-2 col-6');
$('#main-content').scrollspy({ offset: 150, target: '.fa-nav' });
}); });