title: adding styles to appending items
body: <p>I wasn't sure how to phrase the question, so I guess that's also the reason I couldn't find an answer..</p>
  
  <p>I'm appending elements I create in jQuery. I want to add styles to these elements, but my guess is that the elements don't exist yet, so it won't work. What would be a good way to append these styles? I read something about documentFragments, but I don't understand how they work..</p>
  
  <p>(my first try at a jquery plugin:)</p>
  
  <pre><code>(function($) {
      $.fn.flPushbox = function(options) {
      settings = $.extend({
          pager: 'true'
      }, options);
  
      return this.each(function() {
          // set local variables  
          var $pushbox = $(this),
          $slides = $(this).children(),
          $viewport = $('&lt;div class="fl-viewport" /&gt;'),
          init,
          initPager;
  
          //wrap ul with viewport
          init = function (){
              $pushbox.wrap($viewport);
  
              if (settings.pager) initPager();
          }
  
          initPager = function() {
              var $pager = $('&lt;ul class="fl-pager" /&gt;');
  
              for (i=0; i&lt;$slides.length; i++) {
                  var $pagerSlide = $('&lt;li&gt;'+ i +'&lt;/li&gt;');
                  $pagerSlide.appendTo($pager);
              }
  
              $pager.insertAfter($pushbox);
          }
  
          initStyling = function() {
              var pushboxWidth = 0;
  
              $slides.each(function(index, slide) {                   
                  pushboxWidth += parseInt($(slide).outerWidth());
              });
  
              $viewport.css({
                  'position'  : 'relative',
                  'overflow'  : 'hidden'
              });
  
              $slides.css({
                  'float' : 'left'
  
              });
  
              $pushbox.css({
                  'position'  : 'absolute',
                  'top'       : 0,
                  'left'      : 0,
                  'width'     : pushboxWidth
              });
          }
  
          init();
          initStyling();
      });
  }
  })(jQuery);
  </code></pre>