jqueryui.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. $( function() {
  7. $( "#dragAndResize" ).draggable().resizable();
  8. $("#dragAndResize2").draggable({
  9. containment: "parent",
  10. cursor: "crosshair"
  11. });
  12. $( "#dropBy" ).droppable({
  13. drop: function( event, ui ) {
  14. $( this )
  15. .addClass( "ui-state-highlight" )
  16. .find( "p" )
  17. .html( "Colocado!" );
  18. }
  19. });
  20. });
  21. $( function() {
  22. // run the currently selected effect
  23. function runEffect() {
  24. // get effect type from
  25. var selectedEffect = $( "#effectTypes" ).val();
  26. // Most effect types need no options passed by default
  27. var options = {};
  28. // some effects have required parameters
  29. if ( selectedEffect === "scale" ) {
  30. options = { percent: 50 };
  31. } else if ( selectedEffect === "transfer" ) {
  32. options = { to: "#button", className: "ui-effects-transfer" };
  33. } else if ( selectedEffect === "size" ) {
  34. options = { to: { width: 200, height: 60 } };
  35. }
  36. // Run the effect
  37. $( "#effect" ).effect( selectedEffect, options, 500, callback );
  38. };
  39. // Callback function to bring a hidden box back
  40. function callback() {
  41. setTimeout(function() {
  42. $( "#effect" ).removeAttr( "style" ).hide().fadeIn();
  43. }, 1000 );
  44. };
  45. // Set effect from select menu value
  46. $( "#button" ).on( "click", function() {
  47. runEffect();
  48. return false;
  49. });
  50. } );