title: wp_enqueue_script inside shortcode
body: <p>hi so I used a great tutorial off of <a href="http://scribu.net/wordpress/optimal-script-loading.html" rel="nofollow">http://scribu.net/wordpress/optimal-script-loading.html</a> and I am having trouble loading the scripts when a shortcode called lightbox is used here is my code. I am at the page when it is called wanted to check with someone to see if it is properly written.</p>
  
  <pre><code>add_shortcode('lightbox', 'lightbox_handler');
  function lightbox_handler($atts) {
   $base = get_stylesheet_directory_uri();
      wp_enqueue_script('jquery-mousewheel', $base . '/js/jquery.mousewheel-3.0.6.pack.js', array('jquery'), null, true);
      wp_enqueue_script('jquery-fancybox', $base . '/js/jquery.fancybox.pack.js', array('jquery'), '1.0', true);
      wp_enqueue_script('jquery-fancybox-buttons', $base . '/js/jquery.fancybox-buttons.js', array('jquery-fancybox'), '1.0', true);
      wp_enqueue_script('jquery-fancybox-media', $base . '/js/jquery.fancybox-media.js', array('jquery-fancybox'), '1.0', true);
      wp_enqueue_script('jquery-fancybox-thumbs', $base . '/js/jquery.fancybox-thumbs.js', array('jquery-fancybox'), '1.0', true);
  
      wp_enqueue_style('jquery-fancybox', $base . '/css/jquery.fancybox.css', false, '1.0', true);
      wp_enqueue_style('jquery-fancybox-buttons', $base . '/css/jquery.fancybox-buttons.css', array('jquery-fancybox'), '1.0', true);
      wp_enqueue_style('jquery-fancybox-thumbs', $base . '/css/jquery.fancybox-thumbs.css', array('jquery-fancybox'), '1.0', true);
  }
  function lightbox( $atts, $content = null )  {
  
  $defaults = apply_filters( 'toggle_shortcode_args',
      array(
      'title' =&gt; '',
      'id' =&gt; '',
      'type' =&gt; '',
      'rel' =&gt; '',
      'url' =&gt; '',
      )
  );
  
  
  extract( shortcode_atts( $defaults, $atts ) );
  
          $html .= '&lt;a class="'.$id.'" rel="'.$rel.'" data-fancybox-group="gallery" href="'.$url.'" title="'.$title.'"&gt;&lt;img src="'.$url.'" alt="" /&gt;';
          $html .= '&lt;/a&gt;';
  
      return $html;
  }
  </code></pre>