소스 검색

Listing 5.18: prepend pull quotes to their parent.

Frederic G. MARAND 8 년 전
부모
커밋
b4f9f0c753
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      Chapter 5/05.js

+ 5 - 0
Chapter 5/05.js

@@ -44,5 +44,10 @@ $(document).ready(function () {
   $('span.pull-quote').each(function (index) {
     var $parentParagraph = $(this).parent('p');
     $parentParagraph.css('position', 'relative');
+
+    var $clonedCopy = $(this).clone();
+    $clonedCopy
+      .addClass('pulled')
+      .prependTo($parentParagraph);
   });
 });