?
Solved

Need to implement mobile-friendly popup email disclaimer on website

Posted on 2013-11-01
6
Medium Priority
?
470 Views
Last Modified: 2013-11-04
I'm currently in the process of converting a client's static HTML website to Wordpress.

On the following page, .. notice that when you click on the email links, a disclaimer message is displayed in a popup window:

http://wordpress.silvermanacampora.com/contact-us/

When you click on the "Agree" button in the popup -- only then is the mailto link fired off.  

How would you recommend that I replicate this functionality in a way that's more mobile-friendly?  A javascript confirm dialog?  A lightbox/shadowbox popup?  Please advise .. and provide code samples if possible.  

Thanks,
- Yvan
0
Comment
Question by:egoselfaxis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39617066
What you are looking for is a modal.  The pop up currently does not work in chrome browser anyway.  

Using jquery ui modal example from http://jqueryui.com/dialog/#modal I have modified to work with your example
http://jsbin.com/iBiBEda/1/edit?html,js,output
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

<meta charset=utf-8 />
<title>padas</title>
</head>
<body>
  <a href="#" class="emailaddress">somebody1@domain.com</a><br>
  <a href="#" class="emailaddress">somebody2@domain.com</a><br>
  <a href="#" class="emailaddress">somebody3@domain.com</a><br>
 
  <div id="dialog-modal" title="Basic modal dialog">
    <div class="mailto"></div>
 
  </div> 
</body>
</html>

Open in new window

$(function() {
  $('.emailaddress').click(function(){
    var mailto_name=$(this).text();
    var mailto_link='<a href="mailto:'+mailto_name+'?Subject=Help%20me" target="_top">'+mailto_name+'</a>';
    $('div.mailto').html(mailto_link);
    $( "#dialog-modal" ).dialog({
      height: 140,
      modal: true
    });
  });
  });

Open in new window

0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39617093
1)
$('.emailaddress').click(function(){
This listens for the click on the element that has a class of emailaddress

2)
var mailto_name=$(this).text();
This extracts the the email address from the a link

3)
   var mailto_link='<a href="mailto:'+mailto_name+'?Subject=Help%20me" target="_top">'+mailto_name+'</a>';
Here we create the full mailto link

4)
$('div.mailto').html(mailto_link);
This code places the link we just created into the div with class mailto that is in the body of the modal

5)
$( "#dialog-modal" ).dialog({
      height: 140,
      modal: true
    });

The code above calls the modal to open
0
 

Author Comment

by:egoselfaxis
ID: 39621579
Thanks for your reply.  What you've suggested seems as though it might work well on a mobile device.  However .. I have a couple of questions:

1) Is there any way to accomplish this same type of functionality without having to use the JQuery UI library?   I ask because I'm not too keen on the idea of adding more code bloat to my Wordpress site just to accommodate for these disclaimer popups.  

2) Assuming that I have to use JQUery UI for this .. how would I go about increasing the width of the modal window when the website is being viewed on a device other than a mobile device (ie: desktop PC / IPad, etc) ?  Ideally, I'd like for the modal window to be displayed a bit wider/taller when viewed on larger displays.  

- Yvan
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 39621625
I would be surprised that your theme does not already utilize jquery or another library like bootstrap (which has modal's built in).   To answer your question, here is one pure js solution http://jsmodal.com/docs/usage.php

To answer your 2nd question, it would be the same way you adjust for any other object on your page.  If your site is responsive, then you would use media queries.
0
 

Author Comment

by:egoselfaxis
ID: 39621843
I am using JQuery .. but I would prefer to not have to also use JQuery UI .. which is a distinctly separate library (and CSS stylesheet) that adds another 250k to the page.  

Thanks for the Pure JS solution, btw.  I will likely use that.

Cheers!
- Yvan
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39621865
For jquery ui, you don't have to have all of it, you can get just what you need. I am using bootstrap in just about everything I do (or foundation) and I  have been using the modal code built in.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question