JS-手机弹出窗口

时间:2019-01-17 13:43:06

标签: javascript jquery

我有一个电子商务网站。

在结帐页面上,有指向我们的隐私和Cookie政策的链接。

但是,我不想让他们离开结帐页面,因为我想让他们留在那儿继续购买。

因此,除了导航之外,它还会在新窗口中打开,就像这样:

$("#my_link").on("click", function(){
    window.open('my_page.php', '_blank', 'toolbar=0,location=0,menubar=0,width=600,height=800');
});

在移动设备上,它将仅在新标签页中打开,而不是在预期的新弹出窗口中打开,但是我想知道的是,是否有更好的方法可以使用户在结帐时移动。

任何帮助或建议,将不胜感激。

1 个答案:

答案 0 :(得分:0)

由于您正在使用jQuery(如我在代码中所见),因此您可以轻松地使用任何jQuery插件(或jQuery UI)来拥有一个模态或对话框来加载Privacy and Cookie Policy的内容,我的意思是说一次用户点击#my_link

https://jqueryui.com/dialog/

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#dialog" ).dialog();
  } );
  </script>
</head>
<body>

<div id="dialog" title="Basic dialog">
  <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>


</body>
</html>

相关问题