JQuery

Scroll Animation

<script type=”text/javascript”> $(‘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; } } }); </script>

Auto Complete Search

<?php $cars = array(“facebook”, “google”); ?> <link rel=”stylesheet” href=”http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css”> <script src=”http://code.jquery.com/jquery-1.10.2.js”></script> <script src=”http://code.jquery.com/ui/1.11.4/jquery-ui.js”></script> <form id=”frm” method=”post”> <input id=”cartag” type=”text” name=”car”> </form> <script> $(function() { var availableTags = <?php echo json_encode($cars); ?>; $( “#cartag” ).autocomplete({ source: availableTags, select: function (e, ui) { if(ui.item.value==’facebook’){ window.location.href = “http://facebook.com”; } else if (ui.item.value==’google’){ window.location.href = “http://google.com”; } } }); …

Auto Complete Search Selengkapnya »

Maps with Marker

<!DOCTYPE html> <html> <head> <title>Add Marker to Map</title> <meta name=”viewport” content=”initial-scale=1.0, user-scalable=no”> <meta charset=”utf-8″> <style> html, body, #map-canvas { height: 90%; margin: 0px; padding: 0px } </style> <script src=”https://maps.googleapis.com/maps/api/js?v=3.exp”></script> <script src=”https://code.jquery.com/jquery-1.11.1.min.js”></script> <script> var map; function initialize() { var mapOptions = { zoom: 8, center: new google.maps.LatLng(1.288633, 103.837534) }; map = new google.maps.Map(document.getElementById(‘map-canvas’), mapOptions); } google.maps.event.addDomListener(window, …

Maps with Marker Selengkapnya »

JQuery no Conflict

<script type=”text/javascript”> var newJQuery = jQuery.noConflict(true), oldJQuery = jQuery; (function ($) { // code that needs 1.4.2 goes here }(newJQuery)); (function ($) { // code that needs 1.2.6 goes here }(oldJQuery)); // code that needs oldJQuery and newJQuery can go here </script>

×