Skip to content

Instantly share code, notes, and snippets.

var app = {
timer: null,
init: function () {
var instance = this;
$(document).on('pageinit', '#list_page', function () {
$('#searchBox').on('keyup', function () {
var $searchBox = $(this);
var searchFor = $.trim($searchBox.val() + "");
if(instance.timer) {
clearTimeout(instance.timer);
$(document).on("pagebeforechange", function (e, data) {
// We only want to handle changePage() calls where the caller is
// asking us to load a page by URL
if(typeof data.toPage === "string") {
// We are being asked to load a page by URL
var u = $.mobile.path.parseUrl(data.toPage),
_re = "#contact";
if(u.hash.search(_re) !== -1) {
var id = urlParam("id", data.toPage);
$.ajax({
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<script>
var i = 0;
@poonkave
poonkave / google_feed_list.js
Created April 17, 2013 15:37
Dynamically populating jQueryMobile listview from google news feed.
(function () {
var googleResult = [];
var newsTopic = "w";
function initialize() {
var feed = new google.feeds.Feed("https://news.google.com/news/feeds?pz=1&cf=all&ned=en_ie&hl=en&topic=" + newsTopic + "&output=rss");
feed.setResultFormat(google.feeds.Feed.JSON_FORMAT);
//feed.includeHistoricalEntries();
feed.setNumEntries(100);
feed.load(function (result) {
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css"/>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<script>
$(document).on('pageinit', '#home', function () {
// code
var _menuLoaded = false;
$('#menuPanel').load('menu.html', function () {
$(document).on('pageinit', '#home', function () {
// code
var _menuLoaded = false;
$('#menuPanel').load('menu.html', function () {
$(this).find(":jqmData(role=listview)").listview();
$(this).trigger("updatelayout");
$.mobile.loading("hide");
_menuLoaded = true;
});
$("#menuPanel").on("panelopen", function (event, ui) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.js"></script>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQueryMobile popup and iframe form</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.js"></script>
<style>
</style>
@poonkave
poonkave / gist:4475971
Last active December 10, 2015 18:38
Runtime injection of optios/optgroups to jQM select.
var deliveryJSON = {
"optGroups": [{
"label": "FedEx",
"options": [{
"value": "firstOvernight",
"label": "First Overnight"
}, {
"value": "expressSaver",
"label": "Express Saver"
}, {
@poonkave
poonkave / gist:4336235
Created December 19, 2012 12:07
Dynamic LI's and Popups
$(document).on('pageshow', '#home', [], function () {
$("#addLiPopup").one("click", function () {
$(this).hide();
injectLiAndPopup();
});
});
function injectLiAndPopup() {
var _UL = $.mobile.activePage.find(":jqmData(role=listview)");
var _LI = '<li><a><img class="rotate" src="http://jquerymobile.com/demos/1.2.0/docs/lists/images/album-mg.jpg"> <h1>Congratulations</h1> <p> MGMT </p> </a><a href="#congratulations" data-rel="popup" data-transition="flip">Details</a></li>';