我正在尝试制作一个jquery工具提示,以便在mootools灯箱中打开一个链接.
能帮帮我吗...这是我的代码:
头
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script language="javascript" type="text/javascript" src="js/bumpbox.js"></script>
<script src="js/sifr.js" type="text/javascript"></script>
<script src="js/sifr-config.js" type="text/javascript"></script>
<script src="http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js" type="text/javascript"/></script>
<script type="text/javascript">
//no conflict jquery
var $ = jQuery.noConflict();
//jquery stuff
</script>
<script language="javascript" type="text/javascript" src="js/mootools.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen,projection" />
<head>
Run Code Online (Sandbox Code Playgroud)
现在这是我的身体代码:
<p>Phasellus pulvinar lacinia sapien eu lacinia. Sed fermentum augue et lectus ullamcorper quis cursus justo venenatis. Aenean id molestie leo. Vivamus ultrices lobortis velit, quis euismod …Run Code Online (Sandbox Code Playgroud) 我需要触发一次仅与domready事件类似的自定义事件,因为如果在事件发生后添加了新事件,则会立即触发它们.
这是为了某些代码在初始化某些数据和资源之前无法执行,所以我想做这样的事情:
// I am including a script (loadResources.js) to load data and other resources,
// when loadResources.js is done doing it's thing it will fire resourcesAreLoaded with:
window.fireEvent('resourcesAreLoaded');
window.addEvent('resourcesAreLoaded', function() {
// this is fine
});
$('mybutton').addEvent('click', function() {
window.addEvent('resourcesAreLoaded', function() {
// this is not fine, because resourcesAreLoaded has already fired
// by the time the button is clicked
});
});
Run Code Online (Sandbox Code Playgroud)
如果可能的话,我想resourcesAreLoaded运行domready,并在事件已经触发时立即执行代码:
window.addEvent('testIsReady', function() {
alert('firing test');
});
window.fireEvent('testIsReady');
window.addEvent('test', function() {
// this …Run Code Online (Sandbox Code Playgroud) 我有这个小脚本:
var moolang = new Class({
initialize: function(element) {
this.el = $(element);
this.el.addEvent('click', this.popup);
},
popup: function()
{
//this.id = the id of the element.
}
});
Run Code Online (Sandbox Code Playgroud)
我想在弹出功能中知道"this".但如果我尝试像alert(this.el.id)这样的东西,它就说没有这个.el:/
有没有办法知道哪个类添加了事件?
是否有Mootools方式来检测iPhone/Android /其他?我有这个Vanilla JS脚本:
if ( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/Palm/i) )
{
window.location = 'address-to-iphone-site';
}
Run Code Online (Sandbox Code Playgroud)
我知道如何为浏览器(jsfiddle,但不是智能手机)这样做.
任何帮助都会受到欢迎.
我想使用 Mootools 为我的 php 应用程序创建一个选项卡视图。我有n许多从 php 脚本创建的选项卡。我的看法如下。
<div>
<ul id="1">
<li>Popular</li>
<li>New Addition</li>
</ul>
</div>
<div>
<ul id="2">
<li>Popular</li>
<li>New Addition</li>
</ul>
</div>
...
<div>
<ul id="n">
<li>Popular</li>
<li>New Addition</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
如何active根据每个选项卡上Populalar或下的点击应用样式类。New Addition
谢谢
如果你在这里看到一些你认为可以改进的东西,请告诉我!
问题:我正在尝试通过mootools类完成处理一些Json数据的基本结构.我目前遇到的是当我调用'this.processObj'时我收到'processObj未定义'
码:
this.runSomeJson= new Class({
Implements: [Options, Events],
options: {
contentInfo: false,
},
initialize: function(element, options) {
this.element = document.id(element);
if (!this.element) return;
this.setOptions(options);
this.setBasicInfo();
},
setBasicInfo: function () {
var callThis = 'somegenericurl';
this.getObj(callThis);
},
getObj: function (callThis) {
var jsonReq = new Request.JSON({
method: 'get',
url: callThis,
onRequest: function () {
console.log('Loading: ' + callThis);
},
onComplete: function(thisObj){
//console.log(thisObj);
this.processObj(thisObj);
}
}).send();
},
processObj: function (thisObj) {
console.log('in process..');
},
});
Run Code Online (Sandbox Code Playgroud) 我愚弄了这个脚本所以它不是那么笨重,但它的要点是我每秒都得到一个参考错误,我没有函数getList().我试图在它上面和下面移动setInverval(),但它几乎什么也没做.它告诉我一个匿名函数正在调用getList并且它没有被定义.
如果它有所作为我必须添加jquery冲突,以便它不会干扰mootools,我正在运行joomla 1.5
jQuery(document).ready(function($) {
function getList(){
i=0;
$.getJSON(
"./test.php",
function(data)
{
while(data.streams[i]){
channel[i] = data.streams[i];
stats[i] = data.status[i];
title[i] = data.title[i];
viewers[i] = data.viewers[i];
i++;
}
}
);
}
setInterval("getList()", 1000);
});
Run Code Online (Sandbox Code Playgroud)
我尝试通过控制台调试它,但我仍然是控制台调试的新手,所以它没有让我太过分.这个程序单独工作,没有joomla和jquery没有冲突的东西,在HTML文件上就好了所以我不确定什么可能是错的:/
我试图以第二绿色显示日期选择器,但是日期选择器没有出现,但是在第一绿色中它变得很好.我应该修改什么?在小提琴第一次约会即将到来,但是当我点击第二个文本框的绿色时,什么都没有出现.它需要什么类型的修改?
这是小提琴
http://jsbin.com/unosar/8/edit#javascript,html,live
任何解决方案请
我一直在努力做到这一点!任何人都可以帮我将这部分MooTools js脚本转换成jquery吗?该脚本是动态查询构造函数.实时实施在http://opl.bibliocommons.com/search中.
我需要转换的脚本如下.我可以理解这个脚本正在做什么,但我不知道可以执行相同工作的等效jquery函数.任何有关如何处理此事的指示表示赞赏.
var AdvancedSearch = new Class({
Implements: [Options],
options: {
disable_form_message: "Editing this field means you won't be able to use the constructor form. Continue?"
},
initialize: function (instance, options) {
this.setOptions(options);
this.instance = $(instance);
this.query_chunks = this.instance.getElements('div.query_chunk');
this.not_chunks = this.instance.getElements('div.not_chunk');
this.instance.addEvent('submit', this.do_search.bindWithEvent(this));
this.term_count = this.query_chunks.length;
this.not_term_count = this.not_chunks.length;
this.query_field = $('custom_query');
if ($('custom_edit').value == 'false') {
this.query_field.removeEvents('focus');
this.query_field.addEvent('focus', this.disable_form_elements.bindWithEvent(this));
}
this.operation = $('operator');
if (this.operation) {
this.operation.addEvent('change', this.construct_query.bindWithEvent(this));
}
this.query_chunks.each(function (el, i) {
el.getElement('select.parameter').addEvent('change', this.construct_query.bindWithEvent(this)); …Run Code Online (Sandbox Code Playgroud) 我写了一个简单的for循环来基于json响应执行一些DOM操作.这是我的代码
onSuccess: function(a) {
var b = a.items.length;
for (i = 0; i < b; i++)
user_id = a.items[i].id;
$('#user_id').checked = true;
selectUserSettings(user_id);
}
},
Run Code Online (Sandbox Code Playgroud)
在我使用的一个例子中,结果集'a'中有14个项目.for循环,在添加断点时,在0,1,2,2,3,2,3,4,2,3,4,5处显示i的值...基本上它重置并从2开始并且去在再做一遍之前最多增加1个索引...我在这里做错了什么?任何帮助都将不胜感激.