jquery Input City View map usage Introduction _jquery

Source: Internet
Author: User
Copy Code code as follows:

<title></title>//Here to note the sequence of JS introduced
<link href= "Css/jquery.ui.base.css" rel= "stylesheet" type= "Text/css"/>
<link href= "Css/jquery.ui.theme.css" rel= "stylesheet" type= "Text/css"/>
<script src= "Js/jquery-1.9.1.js" type= "Text/javascript" ></script>
<script src= "Js/jquery.ui.core.js" type= "Text/javascript" ></script>
<script src= "Js/jquery.ui.widget.js" type= "Text/javascript" ></script>
<script src= "Js/jquery.ui.position.js" type= "Text/javascript" ></script>
<script src= "Js/jquery.ui.tooltip.js" type= "Text/javascript" ></script>
<link href= "Css/demos.css" rel= "stylesheet" type= "Text/css"/>
<style type= "Text/css" >
. Photo {
width:300px;
Text-align:center;
}
. Photo. Ui-widget-header {
Margin:1em 0;
}
. map {
width:350px;
height:350px;
}
. ui-tooltip {
max-width:350px;
}
</style>
<script type= "Text/javascript" >
$ (function () {
$ (document). tooltip ({
Items: "IMG, [Data-geo], [title]",
Content:function () {
var element = $ (this);
if (Element.is ("[Data-geo]")) {
var text = Element.text ();
Return "<img class= ' map ' alt= '" + text +
"' src= ' Http://maps.google.com/maps/api/staticmap?" +
"Zoom=11&size=350x350&maptype=terrain&sensor=false&center=" +
Text + "' >";
}
if (element.is ("[title]")) {
Return element.attr ("title");
}
if (element.is ("img")) {
Return element.attr ("alt");
}
}
});
$ (' #Button1 '). Click (function () {
$ (' #AName '). Text ($ (' #Text1 '). Val ());
$ (' #AName '). attr (' href ', ' http://maps.google.com/maps?q= ' +$ (' #Text1 '). Val () + "&z=11");
})
});
</script>
<body>
<div class= "Ui-widget photo" >
<div class= "Ui-widget-header ui-corner-all" >
<input id= "Text1" type= "text" value= "China, Shanghai"/><input id= "Button1" type= "button" value= "Settings"/>
</div>
</div>
</body>

Usage: Arbitrarily enter the country and city, with "," separated, click the settings below the hyperlink to change to just set the city, click can jump to the city's view map page, the mouse over the hyperlink will pop up a 350*350 map
Effect Chart:


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.