A basic jQuery plugin that renders a form into the specified target, geocoding input and displaying results from Open North's Represent API.
This plugin extends and reuses code from the Sunlight Foundation's jQuery Find-Your-Rep plugin.
For another take on this, check out The Tyee's plugin and demo.
Try the demo (a good test address is A1A1A1
for St. John's, NL). The full example code is:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Find Your Rep example</title>
<link rel="stylesheet" href="css/jquery.findyourrep.min.css" />
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="js/jquery.findyourrep-pack.min.js"></script>
<script src="js/jquery.findyourrep.ca.min.js"></script>
</head>
<body>
<script>
$('body').append('<div class="fyr"></div>')
.find('div.fyr')
.findYourRep({apis: 'represent'});
</script>
</body>
</html>
- Link, in this order:
- jQuery
dist/js/jquery.findyourrep-pack.min.js
from jQuery Find-Your-Repdist/js/jquery.findyourrep.ca.min.js
from this package- Call
findYourRep({apis: 'represent'})
on an element:
$('.myDiv').findYourRep({apis: 'represent'});
For further documentation, see the jQuery Find-Your-Rep plugin.
Copyright (c) 2014 Open North Inc., released under the BSD3 license