PageRenderTime 52ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/com.jquery.1.2/libraries/jquery_sample.htm

https://github.com/victor-homyakov/frameworks
HTML | 220 lines | 94 code | 35 blank | 91 comment | 0 complexity | 366c601b4ff7276dde917c7558fe5c3c MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, MIT
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  3. <head>
  4. <script type="text/javascript" src="lib/jquery/jquery.js"></script>
  5. <script type="text/javascript" src="jquery_sample.js"></script>
  6. <style type="text/css">
  7. <!--
  8. /* ----- Uncomment the global selector below to over-ride the default margin and padding added to all tags ----- */
  9. *{padding: 0; margin: 0;}
  10. /* ----- global default/initial styles ----- */
  11. body {background-color:#fff; margin: 20px; padding: 0;height:100%}
  12. /* ----- base default font size, type, and line height ----- */
  13. html body{font: 62.5%/1.4em Arial, Helvetica, sans-serif;color:#333333;}
  14. html>body{font: 62.5%/1.4em Arial, Helvetica, sans-serif;color:#333333;}
  15. html {height:100%}
  16. /* ----- add selectors here for font sizing ----- */
  17. .alert{font-size: 1.1em}
  18. p, table, ul, dl {font-size: 1.2em}
  19. code {font-size: 1.4em}
  20. h2 {font-size: 1.6em}
  21. /* ----- base links ----- */
  22. a:link {color: #CC6633;}
  23. a:visited {color: #CC6633;}
  24. a:hover {color: #999966;}
  25. a:active {color: #CC6633;}
  26. a:focus{color: #CC6633;}
  27. h2{padding-top:20px;}
  28. p {line-height:1.4em;margin-right:10px;}
  29. div.contentToChange p {margin:10px 30px 10px 30px;}
  30. ul li {display:inline}
  31. hr{margin:10px 0;}
  32. pre {
  33. border: 1px solid black;
  34. border-color: #BBB #DDD #DDD #BBB;
  35. margin:5px 10px 0 0;
  36. padding: 1em;
  37. line-height: 1.5;
  38. background: white;
  39. overflow: auto;
  40. display:none;
  41. }
  42. code{color:#000000}
  43. .javascript .comment {
  44. color:#999999;
  45. }
  46. .javascript .string{
  47. color:blue;
  48. }
  49. .javascript .keywords {
  50. color:blue;
  51. font-weight:bold;
  52. }
  53. .javascript .global {
  54. color : #0000FF;
  55. }
  56. .javascript .brackets {
  57. color:#FF0000;
  58. }
  59. .changeP{
  60. color: #FFFFFF;
  61. border: 2px solid #CC6633;
  62. position: absolute;
  63. z-index: 1;
  64. width: 150px;
  65. left: 0px;
  66. top: 0px;
  67. background-color: #CC6633;
  68. padding:10px;
  69. line-height:1.4em;
  70. }
  71. .alert {
  72. font-weight: bold;
  73. color: #FFFFFF;
  74. background-color: #FF0000;
  75. padding: 10px;
  76. text-transform:uppercase;
  77. }
  78. .addedtext{
  79. color:#FF0000;
  80. }
  81. -->
  82. </style>
  83. <title>JQuery</title>
  84. </head>
  85. <body>
  86. <p><a href="http://codylindley.com/Javascript/241/jquery-to-the-rescue">JQuery Demo From 'Cody's jQuery Examples'</a></p>
  87. <div style="float:left;width:40%;height:100%">
  88. <h2>Column 1:</h2>
  89. <hr size="1" noshade="noshade" color="#e8e8e8" />
  90. <p><strong>Example A</strong> (View in External Browser)</p>
  91. <p>Get number of paragraphs in column 2 and display that number in an alert box. Including the one in the red box.</p>
  92. <input type="button" value="# of Paragraphs" class="buttonAsize" />
  93. <a href="#" class="codeButtonA">Show&nbsp;/&nbsp;Hide jquery code</a>
  94. <pre class="codeA"><code class="javascript">//Code for example A
  95. $("input.buttonAsize").click(function(){ alert($("div.contentToChange").find("p").size()); });
  96. //show code example A
  97. $("a.codeButtonA").click(function(){$("pre.codeA").toggle()});
  98. </code></pre>
  99. <hr size="1" noshade="noshade" color="#e8e8e8" />
  100. <p><strong>Example B</strong></p>
  101. <p>Animate a paragraph in Column 2 by using a slide animation.</p>
  102. <input type="button" value="Slide Out" class="buttonBslideup" />
  103. <input type="button" value="Slide In" class="buttonBslidedown" />
  104. <a href="#" class="codeButtonB">Show&nbsp;/&nbsp;Hide jquery code</a>
  105. <pre class="codeB"><code class="javascript">//Code for example B
  106. $("input.buttonBslidedown").click(function(){ $("div.contentToChange").find("p.fourthparagraph:hidden").slideDown("slow"); });
  107. $("input.buttonBslideup").click(function(){ $("div.contentToChange").find("p.fourthparagraph:visible").slideUp("slow"); });
  108. //show code example B
  109. $("a.codeButtonB").click(function(){$("pre.codeB").toggle()});
  110. </code></pre>
  111. <hr size="1" noshade="noshade" color="#e8e8e8" />
  112. <p><strong>Example C</strong></p>
  113. <p>Add/Remove text from the end of all &lt;p&gt; elements in column 2 except the paragraph in the red box.</p>
  114. <input type="button" value="Add" class="buttonCAdd" />
  115. <input type="button" value="Remove" class="buttonCRemove" />
  116. <a href="#" class="codeButtonC">Show&nbsp;/&nbsp;Hide jquery code</a>
  117. <pre class="codeC"><code class="javascript">//Code for example C
  118. $("input.buttonCAdd").click(function(){$("div.contentToChange").find("p").not(".alert").append("&lt;strong class=\"addedtext\"&gt;&nbsp;This text was just appended to this paragraph&lt;/strong&gt;")});
  119. $("input.buttonCRemove").click(function(){$("strong.addedtext").remove()});
  120. //show code example C
  121. $("a.codeButtonC").click(function(){$("pre.codeC").toggle()});
  122. </code></pre>
  123. <hr size="1" noshade="noshade" color="#e8e8e8" />
  124. <p><strong>Example D</strong></p>
  125. <p>Remove paragraph with fade and animation.</p>
  126. <input type="button" value="Remove" class="buttonDhide" />
  127. <a href="#" class="codeButtonD">Show&nbsp;/&nbsp;Hide jquery code</a>
  128. <pre class="codeD"><code class="javascript">//Code for example D
  129. $("input.buttonDhide").click(function(){ $("div.contentToChange").find("strong").hide("slow"); });
  130. //show code example D
  131. $("a.codeButtonD").click(function(){$("pre.codeD").toggle()});
  132. </code></pre>
  133. <hr size="1" noshade="noshade" color="#e8e8e8" />
  134. <p><strong>Example E</strong></p>
  135. <p>Change the font weight and color of all Italic text in column 2 by adding CSS properties and values to all &lt;em&gt; elements.</p>
  136. <input type="button" value="Change Italics" class="buttonEitalics" />
  137. <a href="#" class="codeButtonE">Show&nbsp;/&nbsp;Hide jquery code</a>
  138. <pre class="codeE"><code class="javascript">//Code for example E
  139. $("input.buttonEitalics").click(function(){ $("div.contentToChange").find("em").css({color:"#993300", fontWeight:"bold"}); });
  140. //show code example E
  141. $("a.codeButtonF").click(function(){$("pre.codeF").toggle()});
  142. </code></pre>
  143. <hr size="1" noshade="noshade" color="#e8e8e8" />
  144. <p><strong>Example F</strong></p>
  145. <p>Change the CSS on the first paragraph in Column 2 by adding a class value to the &lt;p&gt; element. Adding this new class value to the first p element will place the paragraph in a absolute position box in the upper left hand corner.</p>
  146. <input type="button" value="Add Class" class="buttonFaddclass" />
  147. <input type="button" value="Remove Class" class="buttonFremoveclass" />
  148. <a href="#" class="codeButtonF">Show&nbsp;/&nbsp;Hide jquery code</a>
  149. <pre class="codeF"><code class="javascript">//Code for example F
  150. $("input.buttonFaddclass").click(function(){ $("p.firstparagraph").addClass("changeP"); });
  151. $("input.buttonFremoveclass").click(function(){ $("p.firstparagraph").removeClass("changeP"); });
  152. //show code example F
  153. $("a.codeButtonF").click(function(){$("pre.codeF").toggle()});
  154. </code></pre>
  155. <hr size="1" noshade="noshade" color="#e8e8e8" />
  156. </div>
  157. <div style="float:right;width:60%;height:100%;background-color:#e8e8e8;min-height:900px" class="contentToChange">
  158. <h2 style="margin-left:30px;">Column 2:</h2>
  159. <p class="alert">Use the buttons to the left in the examples to run JQuery code on the structural markup below. Showing the code for each example will display the javascript required for the input buttons, the changes to the structural markup below, and the hide / show feature in the examples.</p>
  160. <p class="firstparagraph">Lorem ipsum <em>dolor</em> sit amet, consectetuer <em>adipiscing</em> elit, sed diam nonummy nibh euismod <em>tincidunt</em> ut laoreet dolore magna aliquam erat <strong>volutpat</strong>. Ut wisi enim ad minim <em>veniam</em>, quis nostrud exerci <strong>tation</strong> ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
  161. <p class="secondparagraph">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse <strong>molestie</strong> consequat, vel illum <strong>dolore</strong> eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer <strong>adipiscing</strong> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
  162. <p class="thridparagraph">Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea <em>commodo</em> consequat. Duis autem vel eum iriure dolor in hendrerit in <em>vulputate</em> velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te <strong>feugait</strong> nulla facilisi.</p>
  163. <p class="fourthparagraph">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, <strong>quis</strong> nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
  164. Duis autem vel eum iriure dolor in <em>hendrerit</em> in vulputate velit <em>esse</em> molestie consequat, vel illum dolore eu feugiat nulla <strong>facilisis</strong> at vero eros et accumsan et <em>iusto</em> odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te <strong>feugait</strong> nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh <strong>euismod</strong> tincidunt ut laoreet <em>dolore</em> magna aliquam erat volutpat.</p>
  165. <p class="fifthparagraph">Lorem ipsum <em>dolor</em> sit amet, consectetuer <em>adipiscing</em> elit, sed diam nonummy nibh euismod <em>tincidunt</em> ut laoreet dolore magna aliquam erat <strong>volutpat</strong>. Ut wisi enim ad minim <em>veniam</em>, quis nostrud exerci <strong>tation</strong> ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
  166. <p class="sixthparagraph">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse <strong>molestie</strong> consequat, vel illum <strong>dolore</strong> eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer <strong>adipiscing</strong> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
  167. </div>
  168. </body>
  169. </html>