Error resolution/Simple media query/dynamic loading css/to determine/html browser compatibility meta settings, such as small issues small knowledge __html

Source: Internet
Author: User

Error: ambiguous mapping found. Cannot map ' Controller ' Bean method

Workaround: Bean Repeat initialization, duplicate mapping name, check the mapping name in @requestmapping () to change

Error: Expected one result (or null) to is returned by SelectOne (), but Found:4

WORKAROUND: The query returns multiple values, either the return value is changed to the collection, or the query returns a single value


Simple Media query:

The meaning is not more than 320px is set before the style, 320-900px this large background is red in this range when the 600-720px background color into blue, 900px later became a set before style

That is to say 320-600px: red; 600-720px: blue; 720-900px: red; 900px after: set front style

@media screen and (min-width:320px) and (max-width:900px) {
	    body{
		    background-color:red;
		}
}
@media screen and (min-width:600px) and (max-width:720px) {
		body{
			background-color:blue;
		}
}

Horizontal screen/vertical screen judgment and action

@media all and (orientation:landscape) { 	
* * Horizontal screen time code/	
} @media All and 	
	
(orientation:portrait) { 	
	body{
  
   width:700px;
	height:800px;
	Transform:rotate (90deg);
	-ms-transform:rotate (90deg);
	-moz-transform:rotate (90deg);
	-webkit-transform:rotate (90deg);
	}
} 	

  

var mql = Window.matchmedia (' (orientation:portrait) ');		
 Console.log (MQL);		
 function Handleorientationchange (MQL) {		
    if (mql.matches) {		
         console.log (' portrait ');  Vertical screen		
         alert ("number");		
     } else {		
         console.log (' landscape ');//Horizontal Screen		
         alert ("horizontal");		
     }//		
 output current screen mode		
 Handleorientationchange (MQL);		
 Monitor screen mode change		
 mql.addlistener (Handleorientationchange);		

HTML static layout browser compatibility meta settings

Dynamically loading CSS and JS to judge the mobile side and dynamically load CSS
Dynamically loading CSS function Includelinkstyle (URL) { var link = document.createelement ("link");	
 link.rel = "stylesheet";	
 link.type = "Text/css";	
 link.href = URL;	
 document.getelementsbytagname ("Head") [0].appendchild (link);	


} includelinkstyle ("http://css.jb51.net/home/css/reset.css?v=20101227");				
    function ispc (URL) {var useragentinfo = navigator.useragent;				
    var Agents = ["Android", "IPhone", "SymbianOS", "Windows Phone", "IPad", "IPod"];				
    var flag = true; for (var v = 0; v < agents.length; v++) {if (Useragentinfo.indexof (agents[v)) > 0) {FL	
            AG = false;//Mobile phone-side var link=document.createelement ("link");				
            Link.rel= "stylesheet";				
            Link.type= "Text/css";				
            Link.href=url; 				
            document.getElementsByTagName ("Head") [0].appendchild (link);				
        Break				}else{//PC End}
    return flag; } ISPC (".. 				
/css/phonelogin.css "); var flag = ISPC ();				
 True is PC-side, false for mobile

Knowledge points are relatively fragmented, used to solve some common problems, follow-up will be in-depth study to solve and add, who let us be the best.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.