mootools

a simple question on jquery closure

旧城冷巷雨未停 提交于 2019-12-17 10:29:12
问题 what does this mean? (function($){ })(jQuery); to make the question clearer, what does wrapping a function in parenthesis mean in JS (sorry, I'm a bit confused on the concept of closures). What about the $ parameter? and the "jQuery" in the end parenthesis? Can I do the same with mootools and combine them in 1 JS file? (function($){})(jQuery); (function($){})(mooTools); I have only worked with jquery and am planning to work with Mootools 回答1: Wrapping a function between parenthesis ensures

jQuery and MooTools Conflict

风格不统一 提交于 2019-12-17 02:31:58
问题 Okay, so I got jQuery to get along with MooTools with one script, by adding this at the top of the jQuery script: var $j = jQuery.noConflict(); and then replacing every: $( with $j( But how would you get MooTools to like the following script that using jQuery?? Thanks in advance for any input, Tracy //Fade In Content Viewer: By JavaScript Kit: http://www.javascriptkit.com var fadecontentviewer={ csszindex: 100, fade:function($allcontents, togglerid, selected, speed){ var selected=parseInt

event.preventDefault() function not working in IE

冷暖自知 提交于 2019-12-16 19:31:47
问题 Following is my JavaScript (mootools) code: $('orderNowForm').addEvent('submit', function (event) { event.preventDefault(); allFilled = false; $$(".required").each(function (inp) { if (inp.getValue() != '') { allFilled = true; } }); if (!allFilled) { $$(".errormsg").setStyle('display', ''); return; } else { $$('.defaultText').each(function (input) { if (input.getValue() == input.getAttribute('title')) { input.setAttribute('value', ''); } }); } this.send({ onSuccess: function () { $('page_1

HTML5 - Select multi required-checkbox

守給你的承諾、 提交于 2019-12-14 04:18:06
问题 I've writen some code here: http://jsfiddle.net/anhtran/kXsj9/8/ Users have to select at least 1 option on the group. But it makes me must click all of them to submit the form. How to do this issue without javascript? Thanks for any help :) 回答1: I think this html5 attribute is only supposed to define which fields are required. You cant put logic in to say "at least one is required". You will need to add custom javascript for this to work (and/or have validation on the server side). hope this

Disable Clipboard & Print Screen on webpage

元气小坏坏 提交于 2019-12-13 21:59:38
问题 i search online but can't get satisfactory result i want to protect images on my website, i know i can disable save as, right click. the real question is can we Disable Clipboard & Print Screen with JQUERY or java script. so no image copy from print screen. thanks 回答1: No. I am pretty sure you can't do that. Print screen is a part of the OS, not the browser. I would hope that web sites weren't able to mess with my OS like that. You can certainly throw roadblocks in front of people trying to

date picker not appearing when cursor is put in textbox

安稳与你 提交于 2019-12-13 20:44:25
问题 I have two date pickers appearing when green color is clicked, but when i am putting mouse cursor on those two text boxes, then nothing appears, only after clicking image/green color date picker is appearing. What modification should i do? In this below fiddle automatically date picker is appearing when cursor is put: http://jsfiddle.net/cBwEK/ I want to add the above function in below fiddle: http://jsbin.com/unosar/19/edit#javascript,html,live I am trying but nothing happens. Any solution

How to get index of clicked element in Mootools

北慕城南 提交于 2019-12-13 16:35:27
问题 how to get index of element in Mootools like in jQuery. For example: this.controls.addEvent('click', function(event){ if (this.hasClass('h-inactiveslideshowcontrol')) { alert(this.index); } }); How to get index of clicked element? 回答1: Loop through the element collection first. this.controls.each(function(element, index){ element.addEvent('click', function(event){ if (this.hasClass('h-inactiveslideshowcontrol')) { alert(index); } }); }); 来源: https://stackoverflow.com/questions/8123650/how-to

.getScript() equivalent in MooTools?

最后都变了- 提交于 2019-12-13 14:14:20
问题 I was wondering if there is a MooTools equivalent to jQuery's .getScript() ? I'm pretty certain that this exists somewhere in MooTools but I haven't been able to find it yet. 回答1: I'm not that familiar with MooTools, but it looks like you can use Asset.javascript. var myScript = Asset.javascript('/scripts/myScript.js', { id: 'myScript', onLoad: function(){ alert('myScript.js is loaded!'); } }); 来源: https://stackoverflow.com/questions/6065725/getscript-equivalent-in-mootools

Mootools - Check for css or js files

天涯浪子 提交于 2019-12-13 06:57:54
问题 I know for append new css or js file I can use Asset class. But if i want check if css or js files are present before Asset?? There is a way? Thx 回答1: you can assign ids to your assets as you bring them in and check against the dom for their presence: Asset.javascript("https://github.com/DimitarChristoff/tippable/raw/master/Source/tippable.js", { id: "someid", onload: function() { alert("loaded"); if (document.id("someid")) alert("already loaded"); } }); 来源: https://stackoverflow.com

MooTools/JS: bindWithEvent

笑着哭i 提交于 2019-12-13 06:41:46
问题 There's this piece in the codebase I'm working on: this.element.addEvent('click', this.clickEvent.bindWithEvent(this)); I want to change it so that the click event makes sure the window is loaded first. So I tried: var t = this; this.element.addEvent('click', function() { window.addEvent('load', function() { t.clickEvent.bindWithEvent(t)); }); }); That doesn't seem to get it to work though. What am I missing? 回答1: You're adding a handler to the load event when the user clicks something,