Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8194425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:49:19+00:00 2026-06-07T04:49:19+00:00

I am attempting to add the jQuery Print Preview Plugin into my website but

  • 0

I am attempting to add the jQuery Print Preview Plugin into my website but I use AddThis’ Print Option. I am not sure if there is a way for me to add the print preview plugin using AddThis. Is there a way?

Here is my code:

JS:

var $j = jQuery.noConflict();
   $j(document).ready(function() {
    $j('a.print-preview').printPreview();
});

AddThis Code:

<!-- AddThis Peekaboo Toolbox : BEGIN -->
<div class="addthis_toolbox addthis_peekaboo_style 
 addthis_default_style addthis_label_style addthis_32x32_style">
<a class="addthis_button_more">Share</a>
<ul>
<li><a class="addthis_button_facebook"></a></li>
<li><a class="addthis_button_twitter"></a></li>
<li><a class="addthis_button_google_plusone_share"></a></li>
<li><a class="addthis_button_email"></a></li>
<li><a class="addthis_button_print print-preview"></a></li>
</ul>
</div>
<!-- AddThis Peekaboo Toolbox : END -->
<script type="text/javascript" src="https://s7.addthis.com/js/
   300/addthis_widget.js"></script>

When I click print it pops up the standard print dialog box in Firefox (or whatever browser I am using.)

I have a feeling that the AddThis JS is using something like JavaScript:window.print(); to trigger the print dialog thus bypassing the jQuery Print Preview Plugin. Is there an easy way to change the AddThis behavior to trigger the print preview?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:49:21+00:00Added an answer on June 7, 2026 at 4:49 am

    I was able to change the behavior of the AddThis print button by removing the classes and adding my own classes. Here is the code:

    Original AddThis Code:

    <!-- AddThis Peekaboo Toolbox : BEGIN -->
    <div class="addthis_toolbox addthis_peekaboo_style 
      addthis_default_style addthis_label_style addthis_32x32_style">
    <a class="addthis_button_more">Share</a>
    <ul>
    <li><a class="addthis_button_facebook"></a></li>
    <li><a class="addthis_button_twitter"></a></li>
    <li><a class="addthis_button_google_plusone_share"></a></li>
    <li><a class="addthis_button_email"></a></li>
    <li><a class="addthis_button_print"></a></li>
    </ul>
    </div>
    <!-- AddThis Peekaboo Toolbox : END -->
    <script type="text/javascript" src="https://s7.addthis.com/js/300/
      addthis_widget.js"></script>
    

    AddThis Code as it appears on the page:

    <div class="addthis_toolbox addthis_peekaboo_style 
       addthis_default_style addthis_label_style addthis_32x32_style">
    <!-- Omited code not relevant to print function. --> 
    <ul style="display: none;"> <!-- Changes to Display Block on Hover --> 
    <!-- Omited code not relevant to print function. --> 
     <li>
      <a class="addthis_button_print at300b" title="Print" href="#">
      <span class=" at300bs at15nc at15t_print"></span>
          Print
       </a>
     </li>
    </ul>
    

    Edited Code to Change Print Function and Call Print Preview Plugin:

    <div class="addthis_toolbox addthis_peekaboo_style 
       addthis_default_style addthis_label_style addthis_32x32_style">
    <!-- Omited code not relevant to print function. --> 
    <ul style="display: none;"> <!-- Changes to Display Block on Hover --> 
    <!-- Omited code not relevant to print function. --> 
     <li>
      <a class="print-preview at-print">
       <span class="at-print-span"></span>
           Print
       </a>
     </li>
    </ul>
    

    CSS to Show Print Correctly:

    .at-print {
      padding: 0 2px;
      float: left;
      padding: 10px 20px !important;
      text-decoration: none;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    
    
    .at-print-span {
      background-position: 0 -576px !important;
      background: url("//s7.addthis.com/static/r07/widget006_32x32_top.png") 
                  no-repeat scroll left center transparent;
      display: block;
      height: 32px !important;
      line-height: 32px !important;
      overflow: hidden;
      width: 32px !important;
     float: left;
    }
    

    I am not sure all of the CSS is needed but it does work.

    IMPORTANT NOTE:

    This is how you will get the Print Button functionality changed so I can call the jQuery Print Preview Function. However, you will throw an error when using the AddThis script and the Print Preview Plugin together. The Print Preview must be modified.

    Here is what must be done around line 44 you will see the following code:

    // The frame lives
            for (var i=0; i < window.frames.length; i++) {
                if (window.frames[i].name == "print-frame") {
                    var print_frame_ref = window.frames[i].document;
                    break;
                }
            }
    

    Replace the above code with this:

    print_frame_ref = print_frame[0].contentWindow.document;
    

    issue solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to add a FB Like Box to a website I'm developing. Not
I am attempting to load some json data into a custom JQuery function. There
I have am attempting to add some input fields to a jquery ui dialog
I am attempting to add an Interbase connection pool to GlassFish v3 to use
I'm attempting to finish up a quick form using jQuery that needs to add
I'm attempting to add 2 values together with jQuery. I have a table with
With the power of jquery... I'm attempting to add two selections together, they both
I'm attempting to use JQuery autocomplete and need to get the id of the
I am attempting to add a shape aesthetic mapping to an existing plot but
I am working with jquery and attempting to add a class to a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.