Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使JQuery工作_Jquery_Asp.net - Fatal编程技术网

如何使JQuery工作

如何使JQuery工作,jquery,asp.net,Jquery,Asp.net,我是JQuery新手,我发现了以下链接: 我想做一个同时切换淡入淡出和幻灯片的操作(幻灯片淡入淡出切换) 这是JavaScript代码: JavaScript: jQuery.fn.slideFadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback); }; 但我不知道如何让它工作。

我是JQuery新手,我发现了以下链接:

我想做一个同时切换淡入淡出和幻灯片的操作(幻灯片淡入淡出切换)

这是JavaScript代码:

JavaScript:

jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
  return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);  
};
但我不知道如何让它工作。以下是我的“淡入淡出”效果代码:


#容器
{
填充:10px;
高度:100px;
宽度:100px;
背景#e459e9;
}
淡出
看着我褪色。

$(文档).ready(函数(){ $(“按钮:第一”)。单击(函数(){ $(this.next().fadeToggle(“slow”); $(这个)。向下滑动(“慢”); }); });
它应该是
$(this).next().slideFadeToggle(“slow”)
$(this).next().fadeToggle(“慢”)

此外,您需要指定所有3个参数-速度、缓和和回调,因为您没有为它们提供默认值


并确保您发布的Javascript函数包含在某个位置,作为外部文件或在
$(文档)之前。准备好了吗

您没有使用您定义的函数。下面的工作

jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
    return $(this).animate({opacity: 'toggle', height:'toggle'}, speed, easing, callback);  
};
$(document).ready(function() {
    $("button:first").click(function() {   
        $(this).next().slideFadeToggle("slow",'',function(){});

    });
})
)


如果要使用编写的扩展名,只需使用
$(this).next().slideFadeToggle(“slow”)
为什么
asp.net
会被标记?感谢respond@leo.vingi,但我不知道该函数应该放在哪里,例如,我把它放在head部分,但每次运行webapp时,我都会得到“JQuery未定义”
jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
    return $(this).animate({opacity: 'toggle', height:'toggle'}, speed, easing, callback);  
};
$(document).ready(function() {
    $("button:first").click(function() {   
        $(this).next().slideFadeToggle("slow",'',function(){});

    });
})