javascript - 数据表响应函数触发时如何重做js
问题描述
我想对表格做一些js函数,就像
var table = $('#example').DataTable({
responsive: true,
});
$(".point").html('hello');
但是当窗口调整大小和响应功能工作时,它不能重做 js 功能。
即使我使用
table.on( 'draw', function () {
console.log( 'Redraw occurred at: '+new Date().getTime() );
$(".point").html('hello');
} );
仍然无法重做js。响应式触发时如何触发功能重做?
解决方案
我认为您应该使用窗口调整大小事件:
$(window).on('resize', function(){
console.log( 'Redraw occurred at: '+new Date().getTime() );
$(".point").html('hello');
});
推荐阅读
- javascript - 仅在下载完成时从 axios 返回对“onDownloadProgress”的响应
- jquery - 使用 jquery 查找活动元素和接下来的 3 个元素
- arrays - 尝试优化此 ruby 代码以进行数组排序/匹配
- node.js - node-cron 可以每分钟运行几秒偏移吗
- homebrew - `brew cleanup` 命令不会删除旧的 mysql 目录
- javascript - 如何使用javascript更改表单的方法名称
- c++ - 在 Windows 上管道到 ffmpeg
- python - Pygame 与 cx_Freeze 一起使用,但当我运行可执行文件时,窗口中没有显示任何内容
- python - 有没有办法将 mxn 矩阵(1)与 pxn 矩阵(2)批量相乘,其中矩阵(2)的每一行都是标量?
- python - 为什么此替换方法无法正常工作