callback jquery plugin printThis -


i trying find solution using search , google, couldn't find , hope can me.

i'm using printthis plugin print parts of page (in case div=modal dialog). plugin-page: https://github.com/jasonday/printthis

after print-dialog called , printed document want close modal dialog automatically, therefore need callback function.

so that's code working printing:

$(".printable").printthis({              debug: false,              printcontainer: false,              pagetitle: $("#info-modal .short-info .panel-headline-wrapper h1").html(),              formvalues: true,              printdelay: 0             }) 

now thought add "done()" function jquery "catches" callback... tried following, didn't work:

$(".printable").printthis({             debug: false,             printcontainer: false,             pagetitle: $("#info-modal .short-info .panel-headline-wrapper h1").html(),             formvalues: true,             printdelay: 0         }).done(function(n){             //close modal dialog         }); 

i found in pull requests: https://github.com/jasonday/printthis/pull/28 don't know how can use it.

i'm using latest version of printthis (v 1.4) , jquery (v 1.11.0)

thank much.

cheers, marco

i author of printthis plugin.

due nature of print dialog, current setup won't work, because there no event tied print dialog (when it's fired, done, etc.). additionally, $.done part of deferred object, or promise. won't work in context.

i haven't yet tested pull request, 'might' work because browser halts , stacks javascript execution while print dialog open. however, don't know how works across browsers.

if in pull request, submitter added instructions in header other instructions. put function in config object.

there option. can close modal on same click event using trigger print functionality. approach simpler, until figure out way incorporate callbacks.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -