function formatstr (num) { var num = (num || 0).tostring(), result = ''; while (num.length > 3) { result = ',' + num.slice(-3) + result; num = num.slice(0, num.length - 3); } if (num) { result = num + result; } return result; }; $.ajax('https://qt.gtimg.cn/q=hk00960', { success: function (res) { var v_hk00960 = res; var array = v_hk00960.split('~'); var $box = $('.container-left'); if (array.length >= 32) { var price = parsefloat(array[9]) == 0 ? array[3] : array[9]; $('.modular-6 .sub-title').html('' + price + ' ' + " hkd") $('.modular-6 ul li').eq(0).find('.num').html(formatstr(parsefloat(array[36] / 10000).tofixed(0))) $('.modular-6 ul li').eq(1).find('.num').html(formatstr((array[37] / 10000).tofixed(0))) $('.modular-6 .announcement span').html('by ' + array[30] + ' hkt quotation subject to delay of 15 minutes or longer
source: tencent finance and economics') if ($(".counter").length > 0) { $(".counter").countup(); } } } }) function gettextcontentwithoutchildren(element) { var text = ''; element.childnodes.foreach(node => { if (node.nodetype === node.text_node) { text += node.textcontent; } }); return text; } $(function () { $('.yearbox dd p').click(function (e) { e.stoppropagation(); $(this).parent().parent().find('dt input').val($(this).text()); $(this).parent().parent().removeclass('open') $(this).parent().slideup(); $(this).addclass('active').siblings().removeclass('active'); }) // 当前页面 var indepage = 1; var pageloading = false; var loadindex = null; $('.modular-4').addclass('loading'); // 示例中的加载新数据逻辑 function loadmoredata() { if (indepage > 0 && !pageloading) { pageloading = true; // loadindex = layer.load(2); $.ajax({ url: '../investor/financial_page_' + indepage + '.aspx', // 指定html文件的路径 type: 'get', datatype: 'html', // 指定返回数据的类型为html success: function (data) { // 这里的data就是读取到的html内容 // 你可以将其插入到dom中 $('.modular-4 ul').append(data); indepage++; pageloading = false // layer.close(loadindex); }, error: function (xhr, status, error) { // 处理错误情况 console.error("error reading the html file:", status, error); indepage = -1; pageloading = false // layer.close(loadindex) // layer.msg('没有更多的数据了'); $('.more').hide(); } }); } } $('.more').click(function () { loadmoredata() }) if ($('.modular-5').length > 0) { var modular5swiper = new swiper('.modular-5 .swiper-container', { nextbutton: '.modular-5 .swiper-button-next', prevbutton: '.modular-5 .swiper-button-prev', slidesperview: 9, paginationclickable: true, breakpoints: { 1024: { slidesperview: 3, } } }); $(document).on('click', '.modular-5 .swiper-slide', function () { $(this).addclass('on').siblings().removeclass('on') $(this).parents('.modular-5').find('.content table').eq($(this).index()).addclass('on').siblings().removeclass('on') modular5swiper.slideto($(this).index()) }) } if ($(".counter").length > 0) { $(".counter").countup(); } $(document).on('click', '.modular-1 .table a', function (event) { if(!$(this).attr('info')){ return false; } $('html,body').css('overflow','hidden'); $('.pop-box .title').html('') $('.pop-box .sub-title').html('') $('.pop-box .details .mcsb_container ').html('') $('.pop-box .title').html(gettextcontentwithoutchildren($(this).find('.box').get(0))) $('.pop-box .sub-title').html($(this).find('.box span').text()) $('.pop-box .details .mcsb_container').html($(this).attr('info')) $('.pop-box').show(); $('.pop-box').animate({ opacity: 1, }, 500, function () { }) event.stoppropagation(); }) $(document).on('click', '.pop-box .window', function (event) { event.stoppropagation(); }) $(document).on('click', '.pop-box .close,.pop-box', function () { var popbox = $(this).hasclass('pop-box') ? $(this) : $(this).parents('.pop-box'); popbox.animate({ opacity: 0, }, 300, function () { popbox.hide(); }.bind(this)) $('html,body').css('overflow',''); }) scolltext($('.pop-box .window .details')) }) function scolltext(obj) { if ($(obj).length > 0) { $(obj).mcustomscrollbar({ scrollinertia: 0, mousewheelpixels: 0, autodraggerlength: true, advanced: { autoscrollonfocus: "" } }); } }