嗨,升级到1.8.2 jquery-ui后,我的应用程序出现问题.我得到一个"this._mouseInit不是函数错误".
包括:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<style type="text/css" media="all">@import "css/pinpoint.css";</style>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/base/jquery-ui.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.pinpoint.js"></script>
Run Code Online (Sandbox Code Playgroud)
这是代码给我错误的地方:
$(window).load(function() {
$.widget("ui.boxTool", $.extend({}, $.ui.mouse, {
_init: function() {
this.element.addClass("ui-boxTool");
this.dragged = false;
this._mouseInit();
this.width = $('#toPinpoint').width();
this.height = $('#toPinpoint').height();
this.helper = $(document.createElement('div'))
.css({border:'1px dashed #c2c0c0'})
.css({cursor:'crosshair'})
.addClass("ui-boxTool-helper");
},
destroy: function() {
this.element
.removeClass("ui-boxTool ui-boxTool-disabled")
.removeData("boxTool")
.unbind(".selectable");
this._mouseDestroy();
return this;
},
_mouseStart: function(event) {
var self = this;
this.opos = [event.pageX, event.pageY];
if (this.options.disabled)
return;
var options = this.options;
this._trigger("start", …Run Code Online (Sandbox Code Playgroud) 我可以在窗口中使用它
$('#dropDownSpan').css('visibility', 'visible');
Run Code Online (Sandbox Code Playgroud)
但是如何在这个窗口的孩子的另一个窗口中使用它,或者可以在这个窗口打开.
我试过了:
$window.parent.('#dropDownSpan').css('visibility', 'visible');
Run Code Online (Sandbox Code Playgroud)
但是没有用,有什么想法吗?
看着提高我的jquery选择器的性能.所以任何提示或文章作为最好的performant jquery选择器?例如,选择div的id.在线任何地方我都可以提供HTML并比较我可以用来选择所需元素的不同选择器.
我们可以在jQuery Calllback函数和misc中执行mySQL查询吗?功能
喜欢简单的查询
UPDATE EMPLOYEE SET PAY = PAY + 500 WHERE E_ID = '32'
Run Code Online (Sandbox Code Playgroud) 是否可以在jquery日历中更改周末日期的字体颜色?我尝试使用类ui-datepicker-week-end,但它只改变了Sun和Sat的字体颜色.我想要的是改变落在太阳和坐着的日子的颜色.
我想通过在按钮和内容div上使用相同的类来打开多个对话框.以下工作但仅限第一次.
jQuery('.helpDialog').hide();
jQuery('.helpButton').click(function() {
jQuery(this).next('.helpDialog').dialog({
autoOpen: true,
title: 'Help',
width: 500,
height: 300,
position: [180,10],
draggable: true,
resizable: false,
modal: false
});
return false;
});
Run Code Online (Sandbox Code Playgroud)
我们知道这个http://blog.nemikor.com/2009/04/08/basic-usage-of-the-jquery-ui-dialog/的原因, 第二个调用被忽略,因为对话框已经被实例化了那个元素."
但是,当我通过尝试下面的代码解决该问题时,对话框不再打开.有人可以帮忙吗?提前致谢
jQuery('.helpDialog').hide();
jQuery(function() {
jQuery('.helpDialog').dialog({
autoOpen: false,
modal: true,
title: 'Info',
width: 600,
height: 400,
position: [200,0],
draggable: false
});
});
jQuery('.helpButton').click(function() {
jQuery(this).next('.helpDialog').dialog('open');
return false;
});
Run Code Online (Sandbox Code Playgroud) 我有可拖动的元素,可以放在可放置的区域.如果删除了一个元素,drop则调用该函数:
$('#droppable').droppable({
scope: "items",
drop: function (event, ui) {
// this one is called if an element is dropped in this droppable area
}
});
Run Code Online (Sandbox Code Playgroud)
我的可拖动元素:
<div class="drag" data-noteid="10">Drag me</div>
...
$('.drag').draggable({
revert: "invalid",
scope: "items"
});
Run Code Online (Sandbox Code Playgroud)
如果元素被删除,我需要知道的是data-noteid可投放区域的值和相对位置.因此,如果元素掉落在左上角,则x/y坐标必须为0/0.
我在这里创建了一个完整的工作示例:http://jsbin.com/utivo5/2/
所以通常我可以访问这样的属性:
alert($(this).data("noteid"));
alert($(this).position().top);
alert($(this).position().left);
Run Code Online (Sandbox Code Playgroud)
但我在这种情况下得到的只是undefined.
有谁知道我如何访问它们?我认为必须可以使用event或者ui哪个是被调用drop函数的参数?!
提前谢谢你,最诚挚的问候,蒂姆.
我正在尝试使用jQuery淡出div,使用fadeOut函数.在大多数情况下,它似乎工作正常,但在某些情况下,并非所有内容都淡出.如果我在div中有一个绝对定位的元素和一个浮动元素,则fadeOut函数不起作用.如果我只有一个绝对定位的元素,它就不起作用.但是如果我有一个绝对定位的元素和一个没有样式的元素,它就可以了.这可能听起来很难解释,但您可以使用此测试代码自行尝试:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>jQuery fadeOut test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
</head>
<body>
<div id="testBox1" style="position: relative">
<div>test</div>
<p style="position: absolute; left: 0; top: 0">This text should fade out.</p>
</div>
<br><br>
<button type="button" onclick="$('#testBox1').fadeOut()">fade out</button>
<!-- works -->
<hr>
<div id="testBox2" style="position: relative">
<div style="float: left">test</div>
<p style="position: absolute; left: 0; top: 0">This text should fade out.</p>
</div>
<br><br>
<button type="button" onclick="$('#testBox2').fadeOut()">fade out</button>
<!-- doesn't work -->
<hr>
<div id="testBox3" style="position: …Run Code Online (Sandbox Code Playgroud) 有没有一种简洁的方法来确保一堆ajax回调都已完成?它们不需要按顺序执行,我只需要所有数据.
一个想法是让他们都在完成时递增一个计数器并检查counter == countMax,但这看起来很难看.还有同步问题吗?(从同时读/写到计数器)
我刚刚将我的jQuery从1.3.2升级到1.4.2,我认为它给了我一些问题.我有一个$.post()调用控制器方法的函数,并传递一些我格式化的数据:
$.post(url, { arrayParam: myArray, param2: false }, someCallback, 'html');
Run Code Online (Sandbox Code Playgroud)
在Firebug中,POST说1.3.2中的参数如下所示:
arrayParam: 100
arrayParam: 101 (etc..)
Run Code Online (Sandbox Code Playgroud)
但对于1.4.2,它们看起来像这样:
arrayParam[]: 100
Run Code Online (Sandbox Code Playgroud)
这打破了我的控制器,它期待一个List<Int32>for arrayParam(并在代码库周围引起一些JSON问题).有没有办法绕过这个没有恢复到1.3.2或重新编程我的所有控制器?
谢谢
jquery ×10
javascript ×3
jquery-ui ×3
ajax ×1
asp.net-mvc ×1
css ×1
dialog ×1
html ×1
jquery-1.3 ×1
jquery-1.4 ×1
mysql ×1
optimization ×1
performance ×1