I have an ad placement system that randomly selects an ad image to display. The user can click on it to get to the respective website, and it has a border that appears when it is hovered over.
However, when customers hover over the ad, I want an option to appear (perhaps in the corner of the image) to print it out (the ads are coupons that may be used at brick and mortar establishments).
Or perhaps, if usability dictates, I would like a link right underneath the ad to start a print dialog.
How would I do this?
You can use the mouseover event to determine when the user has hovered over the element, the click event to be notified when the user clicks the print link, and window.open(...) to open another page that'd have the ad just by itself, and then window.print() in the new window to print the page.
Ideally you'd want to just print without opening a new window, but I'm not aware of any cross-browser way to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With