重构代码: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 {
<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,4 +1,11 @@
$(function () {
$.bc({
url: Menu.iconView,
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;
@ -8,4 +15,7 @@
$iconList.find('div').addClass('col-xl-2 col-6');
$('#main-content').scrollspy({ offset: 150, target: '.fa-nav' });
}
}
});
});