All Products
Search
Document Center

Click the subtitle bar

Last Updated: Feb 23, 2021

Click the subtitle of navigation bar (subtitleClick) to trigger callback.

Use subtitleClick interface

 
  1. document.addEventListener('subtitleClick', function (e) {
  2. alert('subtitle clicked')
  3. }, false);

Code sample

The following code sample demonstrates the basic functions:

 
  1. <h1>Please click the subtitle to see effect </h1>
  2. <script>
  3. document.addEventListener('subtitleClick', function(e) {
  4. alert('subtitle clicked')
  5. }, false);
  6. function ready(callback) {
  7. // Call directly if JSBridge has been injected
  8. if (window.AlipayJSBridge) {
  9. callback && callback();
  10. } else {
  11. // Monitor the injected events if JSBridge hasn't been injected
  12. document.addEventListener('AlipayJSBridgeReady', callback, false);
  13. }
  14. }
  15. ready(function() {
  16. AlipayJSBridge.call('setTitle', {
  17. title: 'Title',
  18. subtitle: 'Subtitle'
  19. });
  20. });
  21. </script>