scriptaculous

Sortable with scriptaculous problems

强颜欢笑 提交于 2019-12-12 06:24:53
问题 Im following a few tutorials to sort a list, but i can't get the DB to update. The drag drop side of things is working, also, i javascript alert() the serialize list onUpdate and the order is printed out as follows: images_list[]=20&images_list[]=19 etc... So the sorting and dragging is working fine, i just cant get the database to update, this is my code. <script type="text/javascript"> Sortable.create("images_list", { onUpdate: function() { new Ajax.Request("processor.php", { method: "post"

scriptaculous and JQuery do not collaborate

谁说我不能喝 提交于 2019-12-11 23:29:45
问题 I am using jQuery slider to browse images and Scriptaculous slider animation on the same page. They work perfectly if I put in two separate pages. When I order the code in this way. <script type="text/javascript" src="/scripts/prototype.js"></script> <script type="text/javascript" src="/scripts/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="/scripts/lightbox.js"></script> <script type="text/javascript" src="/scripts/coda-slider-2.0/jquery-1.3.2.min.js"></script>

mouseover and mouseout events firing on children

眉间皱痕 提交于 2019-12-07 03:36:01
问题 The code: <div id="Navigation" onmouseover="new Effect.toggle('Drop_Down','slide',{duration: 0.8});" onmouseout="new Effect.toggle('Drop_Down','slide',{duration: 0.8});"> <div id="Drop_Down"> <% include Navigation %> </div> </div> If I mouseover the Navigation the Drop_Down div slides down, and if I mouseout it slides up. The problem is if I mouseover the child Drop_Down div it also slides up. Does anyone know how I can fix that? 回答1: Use the mouseenter and mouseleave events instead new in

JavaScript Array Iteration returning more than values

元气小坏坏 提交于 2019-12-06 12:11:42
This is so simple I am baffled. I have the following: var x = 'shrimp'; var stypes = new Array('shrimp', 'crabs', 'oysters', 'fin_fish', 'crawfish', 'alligator'); for (t in stypes) { if (stypes[t] != x) { alert(stypes[t]); } } Once the values have iterated it starts returning a dozen functions like function (iterator, context) { var index = 0; iterator = iterator.bind(context); try { this._each(function (value) {iterator(value, index++);}); } catch (e) { if (e != $break) { throw e; } } return this; } What the heck is going on? Edit: In these scripts I am using http://script.aculo.us/prototype

Preventing JavaScript click event with Scriptaculous drag and drop

余生颓废 提交于 2019-12-06 05:31:38
问题 I have some elements on a page which are draggable. These same elements have a click event which navigates to another page. I'm trying to determine the best way of preventing the click event from firing if the user is dragging but still allow the click event if not dragging. Anyone have any ideas of the best way to accomplish this? 回答1: I solved this by using something like the following: new Draggable('id', { onStart: function() { dPhoto = $('id'); Event.stopObserving('id', 'click'); },

Protecting prototype.js based XHR requests against CSRF

核能气质少年 提交于 2019-12-06 05:15:13
问题 Django has been updated to 1.3, and in fact ever since 1.2.5, it has extended the scheme to pass a Cross Site Request Forgery protection token to XMLHttpRequests. The Django folks helpfully provide an example for jQuery to apply a specific header to every XHR. Prototype (and thus Scriptaculous) have to comply to this scheme, yet I can't find a way to tell prototype to add the X-CSRFToken header. The best would be to do it once in a way that applies it across the app (like for jQuery). Is

Combining Scriptaculous and jQuery in a Rails application

核能气质少年 提交于 2019-12-06 05:12:03
问题 I've got the following situation A rails application that makes use of rjs / Scriptaculous to offer AJAX functionality Lot of nice javascript written using jQuery (for a separate application) I want to combine the two and use my jQuery based functionality in my Rails application, but I'm worried about jQuery and Scriptaculous clashing (they both define the $() function, etc). What is my easiest option to bring the two together? Thanks! 回答1: jQuery.noConflict(); Then use jQuery instead of $ to

Dragging objects out of an IFrame

百般思念 提交于 2019-12-06 04:32:49
问题 I have an IFrame on my page pointing to a page containing list of <li /> elements. The <li /> elements are Draggables created using Scriptaculous library. The question is how do I drag the elements OUT of the IFrame, and drop them on the page containing the IFrame? Is there any library available which supports cross frame dragging & dropping? I don't know about jQuery, but Scriptaculous definitely doesn't support this. 回答1: Check this interesting implementation, it was done using PrototypeJS

mouseover and mouseout events firing on children

百般思念 提交于 2019-12-05 05:58:57
The code: <div id="Navigation" onmouseover="new Effect.toggle('Drop_Down','slide',{duration: 0.8});" onmouseout="new Effect.toggle('Drop_Down','slide',{duration: 0.8});"> <div id="Drop_Down"> <% include Navigation %> </div> </div> If I mouseover the Navigation the Drop_Down div slides down, and if I mouseout it slides up. The problem is if I mouseover the child Drop_Down div it also slides up. Does anyone know how I can fix that? Use the mouseenter and mouseleave events instead new in Prototype 1.6.1 (but not new in IE). You have to move your inline event handlers out of your markup to do this

Can you combine replace_html with a visual_effect in Rails RJS?

自作多情 提交于 2019-12-05 04:29:58
问题 I'm developing a website with Ruby on Rails and I have a div with some content. After clicking a link I want that content to get replaced with some other stuff. This works fine with replace_html and rjs. However, I'd prefer there to be a slight fade/appear (crossfade?) transition between the old and new content. Also the div will be resized a bit so it'd be cooler if this did a grow/shrink effect. I was thinking Scriptaculous must have something like this built in, but I sure can't find it if