轮播图插件
创建于 2024-03-23 /
41
字体:
[默认]
[大]
[更大]
轮播图插件拖拽排序增加
<script>
$("#tbody").sortable({
opacity: 0.6, //设置拖动时候的透明度
revert: false, //缓冲效果
cursor: 'move', //拖动的时候鼠标样式
//handle: '.m_title', //可以拖动的部位,模块的标题部分
update: function(event,ui) {
//var order = [];
$('#tbody tr').each(function(key) {
order = $(this).find('td:first input').val();
console.log(order)
$.ajax({
url: '/admin122.php?s=carousel&c=home&m=displayorder_edit',
type: 'GET',
data: {
key:1,
id: order,
value: key
},
success: function(response) {
console.log(response);
}
});
});
}
});
</script>
home文件修改排序:
\`\`\`
home文件修改排序:
![image.png](/upload/image/20240323/1711183779324520.png)`, {
after() {
titleNavigation();
viewBigPicture();
if(recordFontSet){
$('.font-set[data="'+recordFontSet+'"]').trigger('click')
}
},
})
} catch (e) {
var d = dialog({
id: 'submit-tips',
zIndex: '9999',
fixed: true,
skin: 'submit-warning',
content: '
MD格式渲染出错'
});
d.show();
setTimeout(function () {
d.close();
}, 3000)
}
} else {
titleNavigation();
viewBigPicture();
}
/**
* 隐藏和展开标题导航
*/
$(document).on('click', '.title-nav-hide', function () {
var dom = $(this);
var data = $(this).attr('data');
if (data == 0) {
$('.title-nav').animate({width: '0'}, 500, function () {
dom.attr({
'data': '1',
'title': '展开标题导航'
})
dom.find('i').attr('class', 'am-icon-angle-double-left')
$('.content').css({'margin-right': '5%'});
});
} else {
$('.title-nav').animate({width: '300px'}, 500, function () {
dom.attr({
'data': '0',
'title': '收起标题导航'
})
dom.find('i').attr('class', 'am-icon-angle-double-right');
$('.content').css({'margin-right': '350px'});
});
}
})
//目录栏展开方法
$('.sidebar-nav ul li').on('click', function () {
var sidebarNavIDom = $(this).children('span').children('i')
if (sidebarNavIDom.hasClass('am-icon-caret-right')) {
sidebarNavIDom.removeClass('am-icon-caret-right').addClass('am-icon-caret-down');
$(this).children('ul').children('li').removeClass('sidebar-hide');
} else {
sidebarNavIDom.addClass('am-icon-caret-right').removeClass('am-icon-caret-down');
$(this).children('ul').children('li').addClass('sidebar-hide');
}
return false;
})
$('.sidebar-nav ul li a').on('click', function () {
var target = $(this).attr('target')
if (target) {
window.open($(this).attr('href'))
} else {
window.location.href = $(this).attr('href');
}
})
$('.sidebar-nav ul li.am-active a').parents('li').each(function () {
$(this).children('span').children('i').removeClass('am-icon-caret-right').addClass('am-icon-caret-down')
$(this).siblings().removeClass('sidebar-hide')
$(this).removeClass('sidebar-hide')
})
/**
* 文章点赞
*/
$(document).on('click', '.pes-like', function () {
var dom = $(this);
var num = parseInt($('.pes-like-num').html());
$.ajaxSubmit({
url: '/?g=Doc&m=Article&a=like',
data: {id: '1', aid: '612204361593913344', method: 'PUT'},
method: 'POST',
skipAutoTips: true,
stopJump: true,
success: function (res, dialogOption) {
if (res.status == 200) {
$('.pes-like-num').html(num + 1)
} else {
var d = dialog(dialogOption);
d.show();
setTimeout(function () {
d.close();
}, 1800)
}
}
})
})
$('#pes-show-article-path').on('click', function () {
$('.sidebar, .mask-layer').show()
})
$('.mask-layer').on('click', function () {
$('.mask-layer').hide()
$('.sidebar').animate({opacity: 0, width: '0px'}, 500, function () {
$('.sidebar').removeAttr('style')
})
})
/**
* 页内版本切换
*/
$(document).on('change', '.switch-article-version', function () {
var version = $(this).val();
var aid = $(this).data('aid');
var id = $(this).data('id');
window.location.href = `/?g=Doc&m=Article&a=index&id=${id}&aid=${aid}&version=${version}`;
})
/**
* 快速复制文档地址
*/
$(document).on('click', '.article-copy-link', function () {
var hash = '';
if($(this).parents('.am-article-bd').hasClass('am-article-bd') == true){
hash = '#' + $(this).parent().attr('id')
}
var dom = $(this)
var link = window.location.href.replace(window.location.hash, '') + hash;
const input = document.createElement('input');
input.setAttribute('value', link);
document.body.appendChild(input);
input.select();
if (document.execCommand('copy')) {
dom.addClass('am-text-secondary');
document.execCommand('copy');
var d = dialog({
id: 'copy-tips',
fixed: true,
skin: 'submit-warning',
zIndex: '777',
content: '
复制成功'
}).show();
setTimeout(function () {
dom.removeClass('am-text-secondary');
d.close();
}, 2000)
}
document.body.removeChild(input);
return false;
})
})