Showing posts with label location. Show all posts
Showing posts with label location. Show all posts

Thursday, February 12, 2015

Smooth Scroll Using jQuery

Smooth Scroll Using jQuery Code:


$(function() {
  $('a[href*=#]:not([href=#])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
        $('html,body').animate({
          scrollTop: target.offset().top
        }, 1000);
        return false;
      }
    }
  });
});

Saturday, November 9, 2013

Get Latitude Longitude using Area Zip in PHP

<?php

function getLnt($zip){
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=
".urlencode($zip)."&sensor=false";
$result_string = file_get_contents($url);
$result = json_decode($result_string, true);
$result1[]=$result['results'][0];
$result2[]=$result1[0]['geometry'];
$result3[]=$result2[0]['location'];
return $result3[0];
}

$val = getLnt($zip);
echo "Latitude: ".$val['lat']."<br>";
echo "Longitude: ".$val['lng']."<br>";

?>