– You Don’t Know JS – free ebook series about Javascript

This is a series of books diving deep into the core mechanisms of the JavaScript language. The first edition of the series is now complete.

https://github.com/getify/You-Dont-Know-JS

Read online (free!): “Up & Going”,
Read online (free!): “Scope & Closures”,
Read online (free!): “this & Object Prototypes”,
Read online (free!): “Types & Grammar”,
Read online (free!): “Async & Performance”,
Read online (free!): “ES6 & Beyond”,



is finding a way to tempt the monster to the surface

Nick Cave - 20,000th day on the planet Earth

History.js example with JQuery

Good but it is better using Cookie at complexed page.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″>
<title>Simple History.js Ajax example </title>

<script type=”text/javascript” src=”http://code.jquery.com/jquery-1.8.2.js”></script>
<script type=”text/javascript” src=”https://browserstate.github.io/history.js/scripts/bundled/html4+html5/jquery.history.js”></script>

</head>
<body>

<ul class=”content_links”>
<li><a href=”page_1.html”>Content page 1</a></li>
<li><a href=”page_2.html”>Content page 2</a></li>

</ul>
<div id=”content”>
<p>Content within this box is replaced with content from supporting pages using javascript and AJAX.
</div>

<script>
$(function() {

// Prepare
var History = window.History; // Note: We are using a capital H instead of a lower h
if ( !History.enabled ) {
// History.js is disabled for this browser.
// This is because we can optionally choose to support HTML4 browsers or not.
console.log(‘aaa’);
return false;
}

// Bind to StateChange Event
History.Adapter.bind(window,’statechange’,function() { // Note: We are using statechange instead of popstate
var State = History.getState();
$(‘#content’).load(State.url);
/* Instead of the line above, you could run the code below if the url returns the whole page instead of just the content (assuming it has a `#content`):
$.get(State.url, function(response) {
$(‘#content’).html($(response).find(‘#content’).html()); });
*/
});

// Capture all the links to push their url to the history stack and trigger the StateChange Event
$(‘a’).click(function(evt) {
evt.preventDefault();
History.pushState(null, $(this).text(), $(this).attr(‘href’));
});
});
</script>

 

source: https://github.com/browserstate/history.js/



Give us a kiss

Nick Cave - 20,000th day on the planet Earth

Load picture gallery in jQuery dialog

<script type=”text/javascript”>
$(document).ready(function() {

$(‘.pic_gallery’).click(function() {
// console.log($(this).attr(‘id’).substr(5));
//change dialog iframe id href
url = “{{ URL::to(‘/picture/list’)}}” + “/” + $(this).attr(‘id’).substr(5);
//  console.log(‘url: ‘ + url);
$(“#dialog_iframe”).attr(“src”, url)
$(“#dialog”).dialog(“open”);

//simple page load
// $(“#dialog2”).load(url);
//  $(“#dialog2”).dialog(“open”);
});

$(“#dialog”).dialog({
autoOpen: false,
position: ‘center’,
title: ‘EDIT’,
draggable: true,
width: 700,
height: 450,
});

});
</script>

<div id=”dialog” style=”display:none;” title=”Dialog Title”><iframe id=”dialog_iframe” frameborder=”0″ scrolling=”no” width=”650″ height=”400″ src=””></iframe></div>

******
<a class=”pic_gallery” id=”link_{{$user->users_id}}” href=”#” > Click gallery </a>



You wanna play games OK.

Nick Cave - 20,000th day on the planet Earth