mootools

Jquery Vs Mootools which is having good performance? why?

喜夏-厌秋 提交于 2020-01-02 20:09:30
问题 Can any one reply me which of the javascript frameworks are better to implement on my project? jQuery or Mootools? 回答1: It's a matter of what coding style do you prefer and can help you in the long term. Just because other people use jQuery doesn't make it any easier for me to learn the way that it's coded. This is a must for you to read before you go any further: http://jqueryvsmootools.com/ 回答2: MooTools has the better API and once you actually use it, you'll see how the design choices make

Check whether some element is “focused” without jQuery

让人想犯罪 __ 提交于 2020-01-01 11:06:11
问题 I was almost sure I could find the answer here, but I wasn't successful. How would you check whether is there some object selected (focused) on the moment of the event call? I tried if (document.activeElement == "[object HTMLBodyElement]") , but apparently the .activeElement is being filled onLoad. I am not allowed to use jQuery, only mootools. Thanks a lot for the help! 回答1: https://developer.mozilla.org/en/DOM/document.activeElement - as pointed out, if no element is focused, the document

Check whether some element is “focused” without jQuery

℡╲_俬逩灬. 提交于 2020-01-01 11:04:04
问题 I was almost sure I could find the answer here, but I wasn't successful. How would you check whether is there some object selected (focused) on the moment of the event call? I tried if (document.activeElement == "[object HTMLBodyElement]") , but apparently the .activeElement is being filled onLoad. I am not allowed to use jQuery, only mootools. Thanks a lot for the help! 回答1: https://developer.mozilla.org/en/DOM/document.activeElement - as pointed out, if no element is focused, the document

Best practices for static methods and variables with MooTools classes

与世无争的帅哥 提交于 2020-01-01 03:01:09
问题 Are there any best practices or common solutions to adding support for "static" methods and variables to MooTools-generated classes? In particular, is there any solution that ensures that static initialization takes place before the instance initialize method is called? 回答1: Caveat: Never used MooTools. I've used Prototype a fair bit, though, which has a similar Class system (MooTools is either "inspired by" or a fork of Prototype, depending on who you ask). Just add them as properties on the

AJAX reload div after complete

旧街凉风 提交于 2019-12-31 04:37:07
问题 I am trying to reload just a div once a function has been clicked and executed. $('newThread').addEvent('submit', addThread); function addThread(e){ e.stop(); var threadRequest = new Request.JSON({ url: 'control.php?action=createThread', onSuccess: createThreadSuccess }).post(this); } function createThreadSuccess() { new Element('span',{ 'text':'Post successful.' }).inject($(threadList)); I have been using location.reload(true); but am I correct in saying this will reload the whole page and

document.body is null

牧云@^-^@ 提交于 2019-12-31 04:02:10
问题 I've got a page where I'm using Mootools 1.2.4 and MediaboxAdvanced as a lightbox. I can't seem to get the thing working because of a particular javascript error document.body is null at the initialization of Mediabox: $(document.body).adopt( $$([ overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close), center = new Element("div", {id: "mbCenter"}) ]).setStyle("display", "none") ); The page is here. If yo uclick on the guy's name, picture, or the More Info button on the

How can I inject a string of HTML into an element?

左心房为你撑大大i 提交于 2019-12-31 00:45:29
问题 Using Mootools, we can inject an element into another element: $('childID').inject($('parentID'), 'top'); The second parameter allows me to control the location and can either be 'top' or 'bottom' to inject it into a parent object or 'before' or 'after' to inject it as a sibling. We can also set the HTML of an element from a string: var foo = "<p>Some text</p>"; $('parentID').set('html', foo); My problem is that I want to have the same flexibility with strings as I do with elements. I can't,

Retrieving percentage CSS values (in firefox)

烂漫一生 提交于 2019-12-28 06:44:07
问题 I have a problem retrieving the exact css property value (in '%') on firefox. Suppose we have this extremely simple markup: <div id="box">box</div> and this css: #box{ width:200px; height:200px; left:10%; position:absolute; background:red; } and I'd like to retrieve the left position (in '%') by js It's obv very easy with mootools (demo -> http://jsfiddle.net/steweb/AWdzB/): var left = $('box').getStyle('left'); or jQuery (demo -> http://jsfiddle.net/steweb/RaVyU/): var left = $('#box').css(

Pb with a target_blank link with Mootools

余生颓废 提交于 2019-12-25 16:57:09
问题 within a Joomla 1.6 architecture, I want to apply a target_blank to all external links with the use of window.location.hostname. My (not very pretty) code is thus : http://jsfiddle.net/Y54Me/ But as can be seen, this doesn't apply as I want to certain kind of href, like a href="javascript:;". I'd be glad to get any advice. TKS. 回答1: In this line: if(link.hostname != window.location.hostname) { link.addClass('external'); Change to if(link.hostname != window.location.hostname && !link.hostname

Bing Maps incompatibility with MooTools

≡放荡痞女 提交于 2019-12-25 04:47:11
问题 I have an existing project that uses MooTools that I would like to add a Bing Map to. I've discovered, however, that MooTools breaks Bing Maps. I'm kind of at a loss of how to fix this. Here is a jsfiddle that shows the problem. If you watch your console when you click the Run button, you'll see that Bing throws an exception Uncaught TypeError: n.open is not a function If you then disable MooTools, and hit run again, you'll see the map appears in the results pane. How do I get past this? Is