GoogleMaps = function() {
var t = this;
t.bgImage = 'popover-bg.png';
t.closeImage = 'popover-close.png';
t.modalBgImage = 'popover-modal-bg.png';
t.showing = false;
t.transitioning = false;
t.element = null;
t.duration = 300;
t.popoverMainId = 'popover-main';
t.popoverContainerId = 'popover-container';
t.zoom = 16;
t.debugBox = null;
$(function(){
// cache the popover images
var i1 = document.createElement('img');
i1.src = t.bgImage;
var i2 = document.createElement('img');
i2.src = t.closeImage;
var i3 = document.createElement('img');
i3.src = t.modalBgImage;
});
t.show = function(address)
{
if (t.showing || typeof(address) == 'undefined' || t.transitioning)
return;
t.showing = true;
t.transitioning = true;
if (t.element == null)
{
t.element = $('<div id="popover"></div>');
t.element.addClass('popover-map');
var bg = $('<div id="popover-bg"></div>');
bg.css({'opacity':.5});
t.element.append(bg);
var main = $('<div id="'+t.popoverMainId+'"></div>');
t.element.append(main);
var container = $('<div id="'+t.popoverContainerId+'"></div>');
main.append(container);
var close = $('<a href="#" id="popover-close">Close</a>');
close.click(function(event){
event.preventDefault();
t.hide();
});
main.append(close);
t.element.hide();
$('body').append(t.element);
}
$('#'+t.popoverContainerId).html('');
$('#'+t.popoverMainId).css({
"height" : 593,
"width" : 696,
"position" : "fixed"
});
$('#'+t.popoverContainerId).css({
"border" : "1px solid #C2C2C2",
"height" : 585,
"margin" : 3,
"padding" : 0,
"width" : 687
});
// adjustement for iPhone and Android
if( detectMobileDevice() ){
$('#'+t.popoverMainId).css({
"height" : "100%",
"width" : "100%",
});
$('#'+t.popoverContainerId).css({
"height" : "100%",
"width" : "100%",
"margin" : 0
});
}
// Map
var geocoder = new google.maps.Geocoder();
if (geocoder) {
geocoder.geocode(
{ "address" : address },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
Lng = results[0].geometry.location.lng();
Lat = results[0].geometry.location.lat();
var latlng = new google.maps.LatLng(Lat, Lng);
var mapOptions = {
zoom: t.zoom,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById(t.popoverContainerId), mapOptions);
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map
});
}
}
);
}
// end Map
$(window).bind('resize.popover', t.resize);
t.resize();
t.element.fadeIn(t.duration, function(){
t.transitioning = false;
});
$("body").keypress(function(e){
if ( e.keyCode == 27 ) {
t.hide();
}
});
}
t.hide = function()
{
if (!t.showing || t.transitioning)
return;
t.showing = false;
t.transitioning = true;
t.element.fadeOut(t.duration, function(){
$(window).unbind('resize.popover');
t.element.hide();
t.transitioning = false;
if ($.browser.msie && $.browser.version < 7)
{
$("select#city").css("visibility", "visible");
}
});
}
t.resize = function()
{
var h = $(document).height();
/* var min = $('#header').height() + $('#main').height() + $('#footer').height();
if (h < min)
h = min;*/
t.element.width($("#header-additional").width()).height(h);
// ie6 has template problems that prevent the width of the window from being
// correct. if that is ever fixed this code might not be necissary.
if ($.browser.msie && $.browser.version < 7)
{
var d = $(".content") ;
var o = d.offset();
var p = $('#'+t.popoverMainId);
var w = o.left + ((d.width() - p.width()) / 2);
p.css({'position': "absolute"});
p.css({'left':w});
p.css({'top':'100'});
$("select#city").css("visibility", "hidden");
}
// ie 7 can't center either, apparently
else if ($.browser.msie && $.browser.version < 8)
{
var p = $('#'+t.popoverMainId);
var w = $(window);
var wf = (w.width() - p.width()) / 2;
var hf = (w.height() - p.height()) / 2;
p.css({'left':wf, 'top':hf, 'position': 'absolute'});
}
}
t.debug = function(str)
{
if (t.debugBox == null)
{
t.debugBox = $('<div></div>');
t.debugBox.css({
'position':'absolute',
'top':'0px',
'left':'0px'
});
$('body').append(t.debugBox);
}
t.debugBox.html(str);
}
t.hideEscape = function() {
}
}
function detectMobileDevice() {
var ua = navigator.userAgent;
var checker = {
iphone: ua.match(/iPhone/),
blackberry: ua.match(/BlackBerry/),
android: ua.match(/Android/)
}
if (checker.iphone || checker.android || checker.blackberry ) {
return true;
} else {
return false;
}
}
<script type="text/javascript" src="jquery-1.5.1.min.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?v=3.4&sensor=false&language=cn®ion=CN" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.gstatic.com/intl/es_ALL/mapfiles/api-3/4/16/main.js">
<script src="GoogleMaps.js" type="text/javascript" charset="utf-8"></script>
<script charset="utf-8" type="text/javascript">
var googlemaps = new GoogleMaps();
jQuery.fn.toolTip = function() {
if(!isPad) {
this.unbind().hover(
function(e) {
this.t = this.title;
this.title = '';
$('body').append( '<p id="p_toolTip">' + this.t + '</p>' );
var tip = $('p#p_toolTip').css({ "position": "absolute", "left": "5px", "line-height":"160%", "-moz-border-radius": "5px", "-webkit-border-radius": "5px", "z-index": "9998"});
var target = $(this);
var position = target.position();
this.top = (position.top - 60);
this.left = (position.left + target.width());
tip.css({"top": this.top+"px","left":this.left+"px"});
tip.fadeIn("slow");
},
function() {
this.title = this.t;
$("p#p_toolTip").fadeOut("slow").remove();
}
);
} else {
var lastClicked;
this.unbind().click(
function(e) {
if( !lastClicked ){
lastClicked = this;
rollover(this);
} else {
$("p#p_toolTip").fadeOut("slow").remove();
if (lastClicked == this) {
lastClicked = null;
} else {
lastClicked = this;
rollover(this);
}
}
}
);
}
};
$(document).ready(function(){
$("#storelocator a[title]").toolTip();
});
</script>
<div id="storelocator">
<span class="location_type"><a title="" href="#">查看介绍 »</a></span>
<a href="javascript:googlemaps.show('池州市梅龙镇')" class="location">查看地图</a>
分享到:
相关推荐
标题“Failed to realize: com.sun.media.PlaybackEngine@480457”指出的问题,主要涉及Java多媒体处理中的一个错误。在Java中,`com.sun.media.PlaybackEngine`是Java Media Framework (JMF)的一部分,它是一个用于...
Have you ever tried to install macOS Mojave on your laptop Windows 10? but, before visiting begin ...So begins our article, to indicate you ways How to install macOS Mojave 10.14.3 final on VirtualBox.
This paper introduces how to use kbhit function to realize keyboard interaction, which is recommended to everyone.
An_AXI4-based_DDR1_controller_to_realize_che_FPGA-DDR-SDRAM_An_AXI4-based_DDR1_controller_to_realize_mass,_che_FPGA-DDR-SDRAMSDRAM_An_AXI4-based_DDR1_controller_to_realize_mass,_che_FPGA-DDR-SDRAM.zip
【“Internet +” 实现无缝连接】 随着互联网的诞生,世界变得越来越紧密,人们无需出门就能了解到世界各地的动态。互联网已经渗透到生活的方方面面,工作、交友、购物等都变得更加便捷快速。通过网络,消费者可以...
end systems, as they don’t realize how easy it is to decompile their Android code. In depth examination of the Java and Android class file structures Tools and techniques for decompiling Android ...
Although the new Unity UI system is powerful and quite easy to use, by integrating it with C# scripts, it’s possible to realize the potential of this system and bring an impressive UI to games. ...
Although the new Unity UI system is powerful and quite easy to use, by integrating it with C# scripts, it's possible to realize the potential of this system and bring an impressive UI to games. ...
Finally, you will take a look at some specialized and sophisticated applications of ggplot2, such as how to realize a complex scatterplot matrix, heatmaps, and how to make spatial visualization ...
It will prepare you to realize the full potential of QGIS. What You Will Learn Create and manage a spatial database Learn advanced techniques to style GIS data Prepare both vector and raster data ...
Using_paddlepaddle_to_realize_a_mot(FairMOT)(基于百度飞_FairMOT-Paddle-Tracker_Basic.zip 设计合理: 遵循模块化,便于扩展。 注释相近: 统一风格,易于理解。 Using_paddlepaddle_to_realize_a_mot(FairMOT)...
You will see how to implement different algorithms to get the best possible results, and will understand how to apply them to real-world scenarios. If you want to add an intelligence layer to any ...
《Go-Realize:Go语言构建系统的实时监控与自动重载》 Go-Realize 是一个专门为 Go 语言开发者设计的构建系统,它具备文件观察和重载功能,极大地提升了开发效率。通过运行构建任务,Go-Realize 可以监视文件的变化...
柔性Janus纳米纤维:一种新策略实现可调增强的磁光双功能,奚雪,王进贤,采用静电纺丝技术与自制的平行喷丝头成功地制备了磁光双功能柔性Janus纳米纤维。Janus 纳米纤维由NaYF4:Tb3+/PVP纤维和Fe3O4/PVP纤维这两股...
Shows you how to use 3D data with the Processing programming environment and other languages to create AR prototypes for the web, smartphones, Macs, and PCs Helps 3D artists and designers who want to ...
While getting started with the tool is easy, sometimes it's not as simple to completely realize the power and automation that it can bring to your development work—and that's especially the case ...
Shows administrators how to use VMware to realize significant savings in hardware costs while still pring adequate "servers" for their users Demonstrates how to partition a physical server into ...
In Advanced Apple Debugging and Reverse Engineering, you'll come to realize debugging is an enjoyable process to help you better understand software. Not only will you learn to find bugs faster, but ...