我有一个可缩放地图的以下代码.适用于FF和Safari等,但在进出各级别一两次后死亡.缩放然后停止运行,链接就会消失.IE7会持续一段时间,但最终还是会停止工作.很难想象.此代码来自HiFi和Joel Sutherland的插件.我已经在他的博客上留言并向HiFi发送了一封电子邮件,但没有回复,所以我希望有人可以提供帮助.BHere是主要代码:
/*
* Copyright (C) 2009 Joel Sutherland.
* Liscenced under the MIT liscense
* TODO:
* 1. Create API
* 2. Address accesibility automatically
* 3. Make object oriented
*/
(function($) {
$.fn.zoommap = function(settings) {
settings = $.extend({
zoomDuration: 1000,
zoomClass: 'zoomable',
popupSelector: 'div.popup',
popupCloseSelector: 'a.close',
bulletWidthOffset: '10px',
bulletHeightOffset: '10px',
showReturnLink: true,
returnId: 'returnlink',
returnText: 'Return to Previous Map'
}, settings);
$(this).each(function(){
var map = $(this);
$(this).data('currentId', '');
function showMapById(id){
var region = findRegion(settings.map, id);
if(region != …Run Code Online (Sandbox Code Playgroud) 我一直在尝试使用JQuery来添加或减去表单输入字段.我一直在使用我发现的一个例子作为起点.
这是我到目前为止:
<script type="text/javascript">
$(function(){
// start a counter for new row IDs
// by setting it to the number
// of existing rows
var newRowNum = 2;
// bind a click event to the "Add" link
$('#addnew').click(function(){
// increment the counter
newRowNum += 1;
// get the entire "Add" row --
// "this" refers to the clicked element
// and "parent" moves the selection up
// to the parent node in the DOM
var addRow = $(this).parent().parent();
// copy …Run Code Online (Sandbox Code Playgroud) 有人能告诉我为什么以下不起作用?
<head>
<script language="javascript" src="/assets/js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$("button").bind("click", function() {
alert("You clicked " + $(this).attr("id"));
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<button id="button1">Click Me!</button> <button id="button2">Click Me!</button> <button id="button3">Click Me!</button> <button id="button4">Click Me!</button> <button id="button5">Click Me!</button>
</body>
Run Code Online (Sandbox Code Playgroud)
当我点击任何按钮时,什么也没发生.
戴夫
有人可以告诉我区别:
$(document).ready(function() {
});
Run Code Online (Sandbox Code Playgroud)
和:
var someVar = {
ready : function() {
}
}
Run Code Online (Sandbox Code Playgroud)
要么:
$(function() {
});
Run Code Online (Sandbox Code Playgroud)
我看到事情从三个方面开始,我不知道从哪个方向开始.不同的情况或用途有什么不同?