Search Results

Search found 5 results on 1 pages for 'bebraw'.

Page 1/1 | 1 

  • How to pass a parameter to jQuery UI dialog event handler?

    - by bebraw
    I am currently trying to hook up jQuery UI dialog so that I may use it to create new items to my page and to modify ones existing already on the page. I managed in the former. I'm currently struggling in the latter problem, however. I just cannot find a nice way to pass the item to modify to the dialog. Here's some code to illustrate the issue better. Note especially the part marked with XXX. The {{}} parts are derived from Django template syntax: $(".exercise").click(function() { $.post("{{ request.path }}", { action: "create_dialog", exercise_name: $(this).text() }, function(data) { $("#modify_exercise").html(data.content); }, "json" ); $("#modify_exercise").dialog('open'); }); $("#modify_exercise").dialog({ autoOpen: false, resizable: false, modal: true, buttons: { '{% trans 'Modify' %}': function() { var $inputs = $('#modify_exercise :input'); var post_values = {}; $inputs.each(function() { post_values[this.name] = $(this).val(); }); post_values.action = 'validate_form'; //XXX: how to get the exercise name here? post_values.exercise_name = 'foobar'; $.post('{{ request.path }}', post_values, function(data) { if( data.status == 'invalid' ) { $('#modify_exercise').html(data.content); } else { location.reload(); } }, "json" ); } } }); Here's some markup to show how the code relates to the structure: <div id="modify_exercise" class="dialog" title="{% trans 'Modify exercise' %}"> </div> <ul> {% for exercise in exercises %} <li> <a class="exercise" href="#" title="{{ exercise.description }}"> {{ exercise.name }} </a> </li> {% endfor %} </ul>

    Read the article

  • How to save HTML5 canvas?

    - by bebraw
    Currently I am using Canvas2Image to save the content of my HTML5 canvas. It doesn't appear to work in Google Chrome, however. Any ideas on how to work around the issue are welcome. :)

    Read the article

  • How to set jQuery UI toggle programmatically?

    - by bebraw
    I noticed it is possible to set the value of a jQuery UI slider in the following way: $("#mySlider").slider("value", 42); This triggers the event handlers attached to the slider as expected. Now I'm trying to do the same trick using a button (toggle). There does not appear to be a nice way to do this in the API. I might just be missing something simple. I tried the following with no results: $("#myButton").button().click(); Any ideas how to handle that in this case are welcome. Note that it would be awesome to find a solution that applies for a buttonset as well.

    Read the article

  • Point data structure for a sketching application

    - by bebraw
    I am currently developing a little sketching application based on HTML5 Canvas element. There is one particular problem I haven't yet managed to find a proper solution for. The idea is that the user will be able to manipulate existing stroke data (points) quite freely. This includes pushing point data around (ie. magnet tool) and manipulating it at whim otherwise (ie. altering color). Note that the current brush engine is able to shade by taking existing stroke data in count. It's a quick and dirty solution as it just iterates the points in the current stroke and checks them against a distance rule. Now the problem is how to do this in a nice manner. It is extremely important to be able to perform efficient queries that return all points within given canvas coordinate and radius. Other features, such as space usage, should be secondary to this. I don't mind doing some extra processing between strokes while the user is not painting. Any pointers are welcome. :)

    Read the article

1