1. The mobile terminal does not support window.open

Window. open is not supported on mobile, it will automatically open a new page, you can use the third party plugin layer.open to open the window function.

To use the layer.open plugin, refer to the official API address as follows

Share one of my code and renderings:

  	  $('#gyslb').on('click'.function(){
  	  var gslbs = $("#gslb").val();
	 layer.config({
	      extend: '.. /.. /.. /layer.css' // To customize the popover skin on the mobile side, you can omit it
	   });
	 layer.open({
	      type: 2.area: ['90%'.'90%'].title: 'Select items'.shadeClose: true.// Click mask to close
	      //maxmin: true, // Max and min buttons
	      content: '.. /.. /****. HTML,// address of small window page}); });Copy the code

2. The mobile terminal does not support opener, which causes the callback function to be abnormal

After using layer.open, you can change opener to parent to solve this problem

3. Layer Pops up the events of the parent and child pages call each other

Original parent page

<body>
 
<a data-url="bbbb.html" id="parentIframe">Little hint layer</a>
<input id="shuzhi" />
<button class="but_par">The parent page</button>
</body>
<script src=".. / jquery - 1.9.1. Min. Js. ""></script>
<script src="layer/layer.js"></script>
<script>
$(function(){$("#parentIframe").click(function(){
var a = $(this).attr("data-url");
layer.open({
  type: 2.content: a,
  success: function(layero, index){
    var body = layer.getChildFrame('body', index);// Get the content of the child page
    var iframeWin = window[layero.find('iframe') [0] ['name']].// Get the window object of the iframe page and execute the iframe page method: iframewin.method ();
   body.find("#transmit").click();// Execute the child page method
    body.find('input').val('Hi, I'm from the parent page 'The $()".but_par").click(function(){
    alert(222); }}})); })})Copy the code

Child pages

<body>
<input id="name" value="Dissatisfied" />
<button id="transmit">Pass values to the parent layer</button>
</div>
</body>
<script>
$(function(){$(document).on("click"."#transmit").click(function(){
parent.$("#shuzhi").val($("#name").val()); parent.location.reload(); Refresh the parent page// Close the layer pop-up layer
var index = parent.layer.getFrameIndex(window.name); // Get window index
parent.layer.close(index);
})
window.parent.$(".but_par").click();// Execute the event of the parent page
})
</script>
Copy the code