mootools

Echoing the “then” state of variable in a mootools event even after var has changed

半腔热情 提交于 2020-01-17 12:41:11
问题 Let's take some pseudo-Mootools code: for loop (i) from 0 to 5 { create.element { id: 'element_'+i } $('element_'+i).addevent.click { alert(i); } } The events get added to the elements properly. However, when clicked, they'll all alert the latest iterator... which would be 5. Is there any way I can change "alert(i)" in the event to alert the iterator at that point in time? .toString didn't do much. 回答1: http://www.jsfiddle.net/dimitar/sbytJ/1/ for (var ii = 0; ii < 5; ++ii) { new Element("div

Echoing the “then” state of variable in a mootools event even after var has changed

只愿长相守 提交于 2020-01-17 12:41:07
问题 Let's take some pseudo-Mootools code: for loop (i) from 0 to 5 { create.element { id: 'element_'+i } $('element_'+i).addevent.click { alert(i); } } The events get added to the elements properly. However, when clicked, they'll all alert the latest iterator... which would be 5. Is there any way I can change "alert(i)" in the event to alert the iterator at that point in time? .toString didn't do much. 回答1: http://www.jsfiddle.net/dimitar/sbytJ/1/ for (var ii = 0; ii < 5; ++ii) { new Element("div

javascript new function call with MooTools

倾然丶 夕夏残阳落幕 提交于 2020-01-17 07:24:24
问题 I have found a MooTools version of Nivoo Slider that (in theory) will work with our MooTools dropdown menu. However, the menu is using MooTools 1.2.x, and Nivoo is using 1.3.2 or 1.4.0. Every time I try and use both the menu and the slider, the menu stops working. Are the versions of the MooTools framework not backward compatible? Also, are these plugins compatible or is one overriding the other? I don't know enough about JS to correct my errors or rewrite the function call. Is there a good

mootools, watir webdriver onmouseover take no effect

淺唱寂寞╮ 提交于 2020-01-15 10:57:06
问题 My test shows that webdriver fire_event("onmouseover") takes no effect when page has mootools lib. when remove mootools lib, fire_event("onmouseover") takes effect. how can I get a workaround? html page is following: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script type='text/javascript' src='http://demos111.mootools.net/demos/mootools.svn.js'></script></head> <body> <div onmouseover="document.getElementById('id6').style.display=

How to create a slideshow with drag drop clones

天大地大妈咪最大 提交于 2020-01-15 08:52:28
问题 I want to create a page where the user can choose the images that will be shown in a slideshow. I am attempting to use mootools drag and drop and would like to use lightgallery.js. How can I pass an array of dropped images into the dynamicEL? Is there a way to load the images using the id/class of #cart.item? Any help is greatly appreciated. And apologies in advance for being new at coding. Here is a codepen that only seems to be slightly working http://codepen.io/ssab/pen/QGyKVO $(function()

Reload a cached image with javascript

人走茶凉 提交于 2020-01-15 03:18:46
问题 is it possible to use javascript to reload a particular image that is has cached? On my site users can upload new avatars. After this is done, I want the browser to redownload the new avatar, so the user can see that the change is made. At the moment, I'm doing it like this: $('profilePic').src = 'flash/userImage.ashx?id=12345677&type=avatar&t=' + new Date().getTime() userImage.ashx returns images based on id and queried type. It doesn't use the 't' parameter - this is just so the url is

Reload a cached image with javascript

回眸只為那壹抹淺笑 提交于 2020-01-15 03:18:43
问题 is it possible to use javascript to reload a particular image that is has cached? On my site users can upload new avatars. After this is done, I want the browser to redownload the new avatar, so the user can see that the change is made. At the moment, I'm doing it like this: $('profilePic').src = 'flash/userImage.ashx?id=12345677&type=avatar&t=' + new Date().getTime() userImage.ashx returns images based on id and queried type. It doesn't use the 't' parameter - this is just so the url is

Using JQuery getJSON with other JavaScripts included gives ReferenceError

百般思念 提交于 2020-01-14 10:32:22
问题 I made a small example HTML page to get JQuery's getJSON method working. It looks like below (sorry for the sloppiness, this was just a proof of concept to then later add into a larger project): <script type="text/javascript"> function test() { $.getJSON("http://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key=e999b3a5d47d013b780e8ac255c86266&user_id=24579658@N03&format=json&jsoncallback=?", function(data){ $.each(data.photos.photo, function(i,photo){ $("<img/>")

Firefox 18 breaks mootools 1.2.5 selector engine

懵懂的女人 提交于 2020-01-13 09:53:48
问题 Working jsfiddle example here: http://jsfiddle.net/CfJyd/ The problem only occurs in Firefox 18 that I know of. The following html: <div class="test">Test Div</div> <div class="testIgnore">This should stay the same</div> With this js: window.addEvent('domready',function() { $$('.test').set('html','Only Test should update'); }); Results in this output: Only Test should update Only Test should update Upgrading to Mootools 1.4.5 isn't an option at the moment because of lots of plugins that use 1

How well does jQuery support backward compatibility?

♀尐吖头ヾ 提交于 2020-01-08 21:51:32
问题 We have had issues with Mootools not being very backward compatible specifically in the area of drag and drop functionality. I was wondering if anyone has had any similar problems with jQuery not being backward compatible. We are starting to use it quite heavily and are thinking about upgrading to a newer version to start using several plugins that require it. Will we have any issues if we get rid of the older version? 回答1: jQuery seems to be nicely backward compatible. I have been using it