Viewing 2 replies - 16 through 17 (of 17 total)
  • danolsve

    (@danolsve)

    Thanks fabie_r.
    That was exactly what I needed.
    Cheers!

    fabie_r’s solution works fine except for ie6

    the below code, saved as a javascript file and linked to in your single.php file will add the icon to .pdf links in ie6 as well and won’t conflict with the css attribute solution (thanks to Rebecca Murphey for the code)

    $(document).ready(function() {
    var fileTypes = {
      // extension: 'image file'
      doc: 'doc.gif',
      xls: 'xls.gif',
      pdf: 'pdf.gif'
    };
    
    // then, loop over the object
    // using jQuery's $.each()
    $.each(fileTypes, function(extension,image) {
      $('a[href$="' + extension + '"]').
        css({
          paddingLeft: '20px',
          paddingTop: '2px',
          paddingRight: '2px',
          background: 'transparent url("' + image + '") no-repeat center left'
        });
    });
    
    });

    Replace pdf.gif with the address of the icon you want. You may need to play around with the css rules as well.

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘PDF icon with pdf upload’ is closed to new replies.