Tag: 函数

jQuery多个animate()回调

我试图同时动画一组元素(几乎每个动画之间有一个小的延迟): $(‘.block’).each(function(i){ $(this).stop().delay(60 * i).animate({ ‘opacity’: 1 }, { duration: 250, complete: mycallbackfunction // <- this fires the callback on each animation 🙁 }); }); 所有动画完成后如何运行回调函数?

在jQuery脚本中使用PHP是否可以?

例如: $(document).ready(function(){ $(‘.selector’).click(function(){ }); }); 这会导致问题或减慢页面速度吗? 这是不好的做法吗? 有什么重要的事情我应该知道吗? 谢谢!

如何调用TinyMCE插件function?

如何调用tinymce插件函数? tinymce.activeEditor.plugins.customplugin.customfunction(customvar); 不工作!

jQuery函数

编写像这样的jQuery函数有什么用… $(function myFunction() { … }); 我的意思是为什么将函数包装在$中

jQuery触发器函数高于某个窗口宽度

我正在尝试编写一些jQuery,我遇到了很多问题。 我需要一个函数一直可用,并且当用户窗口大于设置宽度时,有一个函数可用。 这是我的函数,都运行在jQuery(document).ready(function($){ 下拉菜单的function只应在窗口大于设定量时发生; //the dropdown code for desktop users function largeDropDown(){ $(‘#nav ul li’).hover( //open function(){ $(this).find(‘ul’).stop().slideDown(300); }, //close function(){ $(this).find(‘ul’).stop().slideUp(300); } ); } 而这一个一直都可用,虽然知道如何使这个也适应屏幕尺寸会很好。 //the dropdown code for smaller screens $(‘a.menu_trigger’).click(openMenu); function openMenu(e){ e.preventDefault(); if($(this).next(‘ul’).hasClass(‘open_menu’)){ $(this).next(‘ul’).slideUp(300).removeClass(‘open_menu’); $(this).html(“↓”); } else { $(this).next(‘ul’).slideDown(300).addClass(‘open_menu’); $(this).html(“↑”); } } 使用CSS媒体查询时,当窗口超过768px时,将隐藏a.menu_trigger 。 这样jQuery就什么都不做了(至少那是我试图让它工作的尝试!) 所以,我想知道如何使第一个函数在768px以上工作,以及如何在窗口resize时调用此function。 任何帮助都会很棒! 谢谢。

TypeError:f 不是jquery表单提交的函数

我正试图以迂回的方式提交表单,因为我需要在提交之前附加新的输入。 因为在实际的$(form).submit()函数中添加appends不会收集它们的post,我添加了一个html按钮来调用submitCheck(),然后提交实际的函数。 function init() { $(“#submit”).click(submitCheck); //and lots of other stuff } function submitCheck() { //go through fabric canvases, save xml to input. for (var i=1; i<probNum; i++) { var csvg = gcanvas[i].toSVG(); $('#output').append("”); } //make sure a topic was selected. If not cancel submission and don’t do anything. if ($(“#topic”).val() == ‘-1’) { $(‘#error’).html(“You […]

setTimeout和jQuery:Uncaught RangeError:超出最大调用堆栈大小

我试图在页面加载时调用我的类,以及重新加载X秒的结果,但是在setTimeout教程之后,jquery似乎折腾了一个错误,我不明白它是无语法。 未捕获RangeError:超出最大调用堆栈大小 var rand = function() { return Math.random().toString(36).substr(2); }; lhc(); function lhc(){ $(‘#lhcb a’).each(function() { var rawlink = $(this).attr(“href”); var link = encodeURIComponent( rawlink ); var token = rand(); var href = $(this).prop(‘href’); var proceed = $.getJSON( “lhc/link.php?link=” + link + “&a=c”, function( data ) { if ( data.proceed == ‘true’ ) { return […]

Jquery在自定义函数中调用回调函数

我有一个自定义函数,我想添加一个回调函数,我查看了其他问题,但我找不到我的问题的答案。 所以基本上它看起来像这样: function myfunction() { // something } 我有一个不同的函数,我想触发作为回调,最终我想调用myfunction这样: myfunction(callback()); 那么有人可以告诉我这样做的方法吗?

为什么我收到.replace不是函数的错误消息?

我有这个function: function countLitreKgSums(cProductIds){ var cLitreKgSums = new Array(); var cWeek = 0; for(i=0;i<cProductIds.length;i++){ var cLitreKgSum = 0; $("#plan_table td[class='week']").each(function(){ cWeek = $(this).html(); var cLitreKgValue = $("input[name*='plan_table_week" + cWeek + "_prod" + cProductIds[i] + "_']").val(); if (cLitreKgValue == "") { cLitreKgValue = 0; } cLitreKgValue = cLitreKgValue.replace(/,/g, '.').replace(/[^\d\.]/g, '').replace(/\s/g, ''); cLitreKgValue = parseFloat(cLitreKgValue); cLitreKgSum += cLitreKgValue; […]

dataTables .row()不是函数服务器端处理行详细信息

function format ( d ) { return ‘Full name: ‘+ ‘Salary:’+ ‘The child row can contain any data you wish, including links, images, inner tables etc.’; } $(function() { var dtable = $(‘#table_echipamente’).dataTable( { “processing”: true, “serverSide”: true, “ajax”: { “url”: “inc/table_echipamente.php”, “type”: “POST” }, “columns”: [ { “class”: “details-control”, “orderable”: false, “data”: null, “defaultContent”: […]