File tree Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change 11/*!
2- * Start Bootstrap - Grayscale v7.0.5 (https://startbootstrap.com/theme/grayscale)
3- * Copyright 2013-2022 Start Bootstrap
4- * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-grayscale/blob/master/LICENSE)
5- */
2+ * Start Bootstrap - Grayscale v7.0.5 (https://startbootstrap.com/theme/grayscale)
3+ * Copyright 2013-2022 Start Bootstrap
4+ * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-grayscale/blob/master/LICENSE)
5+ */
66//
77// Scripts
88//
@@ -51,4 +51,27 @@ window.addEventListener('DOMContentLoaded', event => {
5151 } ) ;
5252 } ) ;
5353
54+ // Enabling automatically copying email when clicking copy button.
55+ // Showing a popover when copy to clipboard is completed.
56+ let copyEmailBtn = document . getElementById ( 'copyEmail' ) ;
57+
58+ new bootstrap . Popover ( document . querySelector ( '[data-bs-toggle]' ) , {
59+ placement : 'bottom' ,
60+ trigger : 'focus' ,
61+ html : true
62+ } ) ;
63+
64+ //get instance
65+ let popover_instance = bootstrap . Popover . getInstance ( document . querySelector ( '[data-bs-toggle]' ) ) ;
66+
67+ copyEmailBtn . addEventListener ( 'click' , ( ) => {
68+ navigator . clipboard . writeText ( 'aqeebimtiaz@gmail.com' )
69+ . then ( res => {
70+ popover_instance . show ( ) ;
71+ setTimeout ( function ( ) {
72+ popover_instance . hide ( ) ;
73+ } , 1000 ) ;
74+ } ) ;
75+ } ) ;
76+
5477} ) ;
You can’t perform that action at this time.
0 commit comments