Title: Want to modify certain button function
Last modified: August 22, 2016

---

# Want to modify certain button function

 *  Resolved [kamapisachihd](https://wordpress.org/support/users/kamapisachihd/)
 * (@kamapisachihd)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/want-to-modify-certain-button-function/)
 * Yours plugin works very perfectly but I want to make a change to the close/other
   button on the popup window. I want to make the button which on click close the
   tab and open a new window/tab in the background. Can you tell me which function
   I have to modify in the script..
 * [https://wordpress.org/plugins/icegram/](https://wordpress.org/plugins/icegram/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Icegram](https://wordpress.org/support/users/icegram/)
 * (@icegram)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/want-to-modify-certain-button-function/#post-5642363)
 * Hi kamapisachihd,
 * Simple thing would be to use custom button instead of Icegram CTA button.
 * That means leave “Button label” field blank and define your own custom button
   in message body.
 * Write script onclick of that button and it will solve your query.
 * Hope this helps you.
 * Thanks
    Team Icegram
 *  Thread Starter [kamapisachihd](https://wordpress.org/support/users/kamapisachihd/)
 * (@kamapisachihd)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/want-to-modify-certain-button-function/#post-5642470)
 * The above solution works just fine but there is one issue with it. It does not
   close the popup on click . I found the main.js in the message type> popup folder
   but could not determine the function () in js which closes the popup. So can 
   you please tell me which function code should I use to close the popup.
 * Thx.
 *  Plugin Author [Icegram](https://wordpress.org/support/users/icegram/)
 * (@icegram)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/want-to-modify-certain-button-function/#post-5642487)
 * Hi kamapisachihd,
 * Please add ‘ig_cta’ class to the button and it will solve your issue.
 * Let us know how it goes?
 * Thanks,
    Team Icegram
 *  Thread Starter [kamapisachihd](https://wordpress.org/support/users/kamapisachihd/)
 * (@kamapisachihd)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/want-to-modify-certain-button-function/#post-5642510)
 * Hi thanx I made it working..
    For anyone who wants to do the same here is the
   code for !POPUPS! only.. You can remove the default button by keeping the button
   label field and target link fields empty. You need to put the code in the text
   field of popup..
 *     ```
       Your popup message  goes here..
   
       <code>
       <Center>
       <button class="my_button" onclick="myFunction()"> Go to the site </button>
       <script>
       // You can add your own java function for Button 1 . This one will //close the popup and open google in background on click
          function myFunction() {
           window.open("http://www.google.com");
           }
       </script>
       <button class="my_button" onclick="myFunction2()"> EXIT </button>
       <script>
       // You can add your own java function for Button 2. This one redirects //to the bewlow URl
       function myFunction2() {
           location.replace("http://www.w3schools.com")
       }
       </script>
       <style>
        /* If you want to hide the close button keep this otherwise remove it */
       .ig_popup .ig_close {
       	display: none;
       }
   
       /* CSS for your button > You need to find the 'ig_button_your chosen popup theme' s code and paste it below between { ..} to make it look like the popups default button  */
   
       .my_button{
           background: none repeat scroll 0 0 hsl(145, 63%, 49%) !important;
           border-radius: 3px;
           box-shadow: 0 -3px 1px rgba(0, 0, 0, 0.45) inset, 0 2px 2px rgba(0, 0, 0, 0.25);
           color: hsl(0, 100%, 100%);
           font-family: Calibri,Candara,Segoe,"Segoe UI",Optima,Arial,sans-serif;
           font-size: 1.3em;
           font-weight: 700;
           letter-spacing: 1px;
           line-height: 1.8em;
           margin: 0 auto;
           padding: 0.3em 1em;
           text-align: center;
           text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
           vertical-align: top;
           width: 40%;
       }
       </style>
       </code>
       ```
   
 * And one last thing the popup closes on the background click.. If you want to 
   remove this function
    Go to : /wp-content/plugins/icegram/message-types/popup/
   and edit main.js like this by commenting out this three lines:
 *     ```
       // bind click event of overlay to hide
                  // jQuery('#TB_overlay').bind('click',function(){
                  //     self.hide();
                  // });
       ```
   
 * There is one problem with code that with certain themes it shows white bars,
   
   dont know what is wrong but looks like some themes default styling messes up 
   the with popup CSS.
 * [
    Screenshot
 * Would be great if fixed in next update..
    Cheers!!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Want to modify certain button function’ is closed to new replies.

 * ![](https://ps.w.org/icegram/assets/icon-128x128.gif?rev=3469073)
 * [Icegram Engage – Popups, Optins, CTAs & Lead Generation](https://wordpress.org/plugins/icegram/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/icegram/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/icegram/)
 * [Active Topics](https://wordpress.org/support/plugin/icegram/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/icegram/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/icegram/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [kamapisachihd](https://wordpress.org/support/users/kamapisachihd/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/want-to-modify-certain-button-function/#post-5642510)
 * Status: resolved