It’s always gratifying to see your work being used. Nothing can be more frustrating than spending hours, day, or weeks working on a project you believe in only to see it languish and fade away into obscurity. Without a doubt the Before/After plugin is this site’s most popular plugin. It’s been described as ‘remarkable’, ‘powerful’, ‘genius’, ‘cool’, ‘amazing’, and used in a variety of ways to show the dramatic impact of topics like natural disasters, medical procedures, remodeling, and much more. I’d like to add NASA as one of our newest Before/After plugin users. Head on over to NASA’s Earth Observatory and check out some of their amazing imagery including some cool before and after pictures which now use the Before/After plugin.
NASA Using Before/After
Aug 22nd, 2011 by admin | No Comments »
New jQuery Plugin – The Page Carousel
Aug 8th, 2011 by admin | 5 Comments »
jQuery Page Carousel Plugin
About a year ago I was asked to create a plugin that allowed visitors to navigate a series of web pages without having to ever actually leave one page. What I came up with I’m calling the Page Carousel plugin. The Page Carousel allows you to take an unordered list and turn each item into its own page.
Features:
- Turns an unordered list into a web page carousel. Have an entire website run from one page.
- Each “page” is bookmarkable and can be linked to directly
- Shortest path algorithm finds the shortest path to the selected page. For example, in a seven page site if you navigate from page 2 to page 7, the carousel slides to the right three pages instead of to the left five pages.
- Peek effect. Allows users to see part of the previous and next pages.
- Keyboard navigation. Use the left and right arrows to navigate.
- Customizable navigation links and arrow images.
- Resizes with browser.
- Separate left/right easing effects
- Callback functions
- Degradable. No JavaScript? No problem!
Download
- jquery.pagecarousel.js (13k)
Demos
View each demo’s source code for options and styling.
How to Use
Build an unordered list and wrap it in a div with an ID. Point to jQuery and the plugin (using an easing plugin is optional):
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery.easing.1.3.js"></script>
<script type="text/javascript" src="jquery.pagecarousel.js"></script>
<script type="text/javascript">
$(function(){
$('#container').pageCarousel({
nextPrevImagePath: 'images/nextprev.png',
transitionSpeed:500,
padding:'10px',
peekAmount: '20px',
showLinks: true,
pageWidth: '800px',
linkPosition: 'top',
easeLeft: 'easeInOutExpo',
easeRight: 'easeInOutExpo'
});
});
</script>
Options
The following options are configurable:
- viewDuration: the time (in milliseconds) to pause between a completed image and the next image (default: 4000)
- transitionSpeed: the time (in milliseconds) to complete a page transition (default: 800)
- showLinks: Boolean value of whether to display navigation links based on each list item’s title attribute (default: true)
- showArrows: Boolean value of whether to display navigation arrow images (default: true),
links: Which side of the page navigation links should be displayed (left, right, both (default) ) - linkPosition: Where navigation links should be placed on the page (under (default), top, or bott0m)
- navWidth: Width of the navigation links (default ’60px’)
- navHeight: Height of the navigation links (default ’20px’)
- pageWidth: The width of the “page” container (default $(document).width())
- easeLeft: The easing effect used when moving all pages to the left (default ‘linear’)
- easeRight: The easing effect used when moving all pages to the right (default ‘linear’)
- nextPrevImagePath: Path to arrow sprite (default ‘/js/pagecarousel/images/nextprev.png’)
- nextPrevImageSize: The width and height of the arrow navigation sprite image (default {‘width’:96,’height’:48})
- padding: The amount of padding to apply to each page (default ’0px’)
- peekAmount: The amount of the previous and next pages to hint at (default ’0px’)
- scrollContainer: Boolean value of whether to wrap the pages in a div to force a scroll bar to appear directly next to the pages instead of on the browser window (default false)
- onSlideStart: A callback function.
- onSlideEnd: A callback function.
Easing
While you can use whatever easing effects you like, I’ve found that the best effects are: easeOutCubic, easeInQuart, and easeOutExpo with a one second or less duration. I’m not crazy about easeInElastic, easeInOutElastic, easeInBounce, easeOutBounce, and easeInOutBounce, but feel free to experiment. Note that easeOutElastic, easeInBack, easeOutBack, and easeInOutBack can produce some interesting (if not odd) results.
Enjoy!
What’s a Namespace?
Aug 2nd, 2011 by admin | No Comments »
You may have heard the term “namespace” and had a vague idea (or no idea whatsoever) what it referred to. A namespace is a coding term that pops up from time to time as something you should probably know about but don’t have to get through your day. Knowing when to use a namespace is both a good coding practice and a courtesy to other developers. In this article I’ll give you an overview about what a namespace is and how it works with a focus on JavaScript. Continue Reading »
Hey Google. Where’s My Toolbar for Firefox 5?
Jul 7th, 2011 by admin | 5 Comments »
It’s been what, like three weeks now and you still haven’t updated the toolbar to work with Firefox 5? What’s the deal?
Update (July 22, 2011): This kinda pisses me off. Apparently Google is dropping support for the Google Toolbar in Firefox 5+ (“Therefore, while Google Toolbar for Firefox works on versions up to and including Firefox 4 only, it will not be supported on Firefox 5 and future versions.”). I’m not just pissed that I’m losing a bunch of functionality I use every day, but now I have to hunt and peck to cobble together replacements for the tools I use every day. Thanks a lot Google.
Source: http://googletoolbarhelp.blogspot.com/2011/07/update-on-google-toolbar-for-firefox.html
Update (October 7, 2011): Someone over at optimize-your-pc.org discovered a nice hack to get the toolbar working again in FF7! All it takes is two quick modifications to some files for the toolbar and you’re back in business. Worked for me in Windows 7 and XP. Check it out at http://www.optimize-your-pc.org/use-google-toolbar-on-firefox-6-and-7.
A jQuery + Canvas Scratch Off
Jun 28th, 2011 by admin | 1 Comment »
I’ve worked on Flash scratch off card applications for many years, and the other day I wondered if it was possible to get the same effect without Flash. I’m a huge jQuery fan — it never fails to make my JavaScript coding easier, but I know that jQuery doesn’t have the ability alone to simulate such an effect. This lead me to the red-headed stepchild element in the HTML universe, <canvas>. The canvas element has always been one of those tags that I’ve known about but never really gotten into, mainly because there’s so much that it can do that it’s more than just your average HTML element. In a nutshell, the canvas element allows you to draw using JavaScript. Perfect. Now all I had to do was learn canvas. Continue Reading »