Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

bleech/jquery.modalview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Modalview

A simple prefetching ajax modal plugin. Prefetches the target page DOM and displays it in a modal when clicking on the link.
Accepts a JSON response with a content attribute too.
Opens given content as string too.

Getting Started

Download the production version or the development version.
Integrate the basic styles from the stylesheet and add your own styling.

Markup

<a href="somepage.html" class="modal">Some page</a>

jump to a DOM element referenced by hash string

<a href="somepage.html#qunit-fixture" class="modal">Some page</a>

add a custom class to the modalview container

<a href="somepage.html" class="modal" data-modalclass="custom">Some page</a>

Initialization

$('.modal').modalview();

or

$.modalview('some content');

Options

// setting global default options
$.fn.modalview.options = {
	selector:   '#main',
	closeText:  'close',
	padding:    10,
	width:      580,
	onInit:     function () {},
	onOpen:     function () {},
	onClose:    function () {}
};

// setting custom instance options
$('.modal').modalview({
	selector:   '#main',
	closeText:  'close',
	padding:    10,
	width:      580,
	onInit:     function () {},
	onOpen:     function () {},
	onClose:    function () {}
});

Roadmap

  • refactoring to automatically set the target width & padding (is this a good idea?)
  • refactoring close button (html string?)
  • making the plugin extendable globally and per instance (prototypal inheritance)

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "src" subdirectory!

License

Copyright (c) 2012 bleech
Licensed under the MIT, GPL licenses.

About

A simple prefetching ajax modal plugin.

Resources

License

GPL-2.0, MIT licenses found

Licenses found

GPL-2.0
LICENSE-GPL
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published