Category Archives: Javascript

javascript, js

RequireJS + Zurb Foundation

“use strict”; require.config({ baseUrl: ‘static’, paths: { jquery: ‘bower_components/jquery/dist/jquery’, foundation: ‘bower_components/foundation/js/foundation’, }, shim: { ‘foundation’: { deps: [‘jquery’] }, } }); require([‘foundation’], function(f){ $(function(){ alert(1); }); });

Javascript Snippet: Play next video

There is a requirement from one of my project to insert video ads before the actual video gets played. There are ways to do it, one is to use JWPlayer and OVA plugin, or the other way is to write your own javascript to control the playback. In the following demo, shows how you can… Read More »

How to extend JQuery UI plugin

The existing dialog plugin doesn’t have an option to close dialog on clicking modal overlay, how to add an option to provide the functionality? (function($){ var _init = $.ui.dialog.prototype._init; $.ui.dialog.prototype._init = function(){ var self = this; _init.apply(this,arguments); $(‘.ui-widget-overlay’).live(‘click’, function(){ if (self.options[‘overlay_close’]){ self.destroy(); } }); } })($);

Google Map v3 OverlayView Code Sample

Today I was writing some google map javascripts and had to implement the icons via OverlayView class, so I think I might share it in case anyone need some sample code. //”gmap” is an instance of the google map //creating the class to exntend the google map OverlayView class function MapLocationIcon(id,lat,lng,title,icon_class){ = lat; this.lng… Read More »