Home  >  Article  >  Web Front-end  >  Xiaoqiang’s HTML5 mobile development road (38) - jqMobi plug-in ActionSheet

Xiaoqiang’s HTML5 mobile development road (38) - jqMobi plug-in ActionSheet

黄舟
黄舟Original
2017-02-13 14:16:591531browse

Action Sheets are very common on mobile clients now, such as the share button menu in WeChat. Below we use jqMobi to implement an Action Sheet, as follows:


First right-click the button above and select Inspect Element (I am using the Chrome browser, press F12 first)



<a class="button" onclick="showCustomHtmlSheet()">Show Custom Html Sheet</a>


Then Ctrl + F to find the showCustomHtmlSheet() method


The code is posted as follows:


   function showCustomHtmlSheet() {
           $("#afui").actionsheet(&#39;<a  >Back</a><a  onclick="alert(\&#39;hi\&#39;);" >Show Alert 3</a><a  onclick="alert(\&#39;goodbye\&#39;);">Show Alert 4</a>&#39;);
   }

We can see that there are three button links in the above function. The last Cancel in the above picture is the system default cancel button.


Ctrl + F to find a plugin, you can see the following line


<link rel="stylesheet" type="text/css" href="plugins/css/af.actionsheet.css">


Okay, let’s start to achieve the above effect in our project:

First introduce the af.actionsheet.css file


will Put the above code into content


 



jqMobi


<link rel="stylesheet" type="text/css" href="plugins/css/af.actionsheet.css">


 
 
	

<a class="button" onclick="showCustomHtmlSheet()">Show Custom Html Sheet</a>

//底部

<script> function showCustomHtmlSheet() { $("#afui").actionsheet(&#39;<a >Back</a><a onclick="alert(\&#39;hi\&#39;);" >Show Alert 3</a><a onclick="alert(\&#39;goodbye\&#39;);">Show Alert 4</a>&#39;); } </script>

The running result is:




The above is the content of Xiaoqiang's HTML5 mobile development road (38) - jqMobi plug-in ActionSheet. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn