code_junkie

Prevent an element from “capturing” the mouse using jQuery?

Nov 11th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. <div style="text-align:center; padding-top:50px;">
  2. <div id="doc" style="width:384px;height:512px;">
  3. <iframe id="docFrame" style="width: 100%; height: 100%;"
  4. src='http://www.ready.gov/america/_downloads/sampleplan.pdf'>
  5. </iframe></div></div>
  6. <div id="data"></div>
  7. <script type="text/javascript">
  8. $(document).ready(function() {
  9. var obj = $('#docFrame');
  10. $('#doc').resizable({handles:'all', resize: function(e, ui) {
  11. $('#data').html(ui.size.width + 'x' + ui.size.height);
  12. obj.attr({width: ui.size.width, height: ui.size.height});
  13. }});
  14. });
  15. </script>
  16.  
  17. $(document).ready(function() {
  18. var obj = $('#docFrame');
  19. $('#doc').resizable(
  20. {
  21. handles: 'all',
  22. resize: function(e, ui) {
  23. $('#data').html(ui.size.width + 'x' + ui.size.height);
  24. obj.attr({ width: ui.size.width, height: ui.size.height });
  25. },
  26. start: function(e, ui) { $('#docFrame').hide(); },
  27. stop: function(e, ui) { $('#docFrame').show(); }
  28. });
  29. });
  30.  
  31. <div style="text-align: center; padding-top: 50px;">
  32. <div id="doc" style="width: 384px; height: 512px; position: relative;">
  33. <div id="overlay" style="position: absolute; top: -5px; left: -5px;
  34. padding: 5px; width: 100%; height: 100%; background: red;
  35. opacity: 0.5; z-index: 1; display: none;"></div>
  36. <iframe id="docFrame" style="width: 100%; height: 100%; position: relative; z-index: 0;"
  37. src='http://www.ready.gov/america/_downloads/sampleplan.pdf'></iframe>
  38. </div>
  39. </div>
  40. <div id="data"></div>
  41. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js" type="text/javascript" charset="utf-8"></script>
  42. <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
  43. <script type="text/javascript">
  44. $(document).ready(function() {
  45. var obj = $('#docFrame'), overlay = $('#overlay');
  46. $('#doc').resizable({
  47. handles: 'all',
  48. start: function() {
  49. overlay.show();
  50. },
  51. resize: function(e, ui) {
  52. $('#data').html(ui.size.width + 'x' + ui.size.height);
  53. obj.attr({
  54. width: ui.size.width,
  55. height: ui.size.height
  56. });
  57. },
  58. stop: function(e, ui) {
  59. overlay.hide();
  60. }
  61. });
  62. });
  63. </script>
Add Comment
Please, Sign In to add comment