Adding buttons to desktop and mobile toolbars

45 views
Skip to first unread message

Matt Parizeau

unread,
Nov 3, 2016, 6:13:14 PM11/3/16
to PDFTron WebViewer
Q:

I've added a couple custom buttons through my config.js file and they show up in the desktop viewer. However I'm using the same config.js file for mobile devices and the buttons aren't appearing in the toolbar. How can I fix this?

A:

The mobile viewer's toolbar uses different elements than the desktop viewer's toolbar so you'll have to add the buttons a bit differently. Here's an example of adding a button to the mobile toolbar:

if ($.mobile) {
 
var button = $('<a id="customButton" data-transition="none" class="mobile-button"><span class="glyphicons download"></span></a>');
  button
.on('click', function() {
    console
.log('click');
 
});
  $
('#defaultMenuContext').append(button);
}

Reply all
Reply to author
Forward
0 new messages