Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added input button support #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Calling facebox() on any anchor tag will do the trick, it's easier to give your

jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox()
$('input[rel*=facebox]').facebox()
})

Any anchor links with `rel="facebox"` with now automatically use facebox:
Expand All @@ -44,6 +45,8 @@ Any anchor links with `rel="facebox"` with now automatically use facebox:
<a href="terms.png" rel="facebox">Terms</a>
Loads the terms.png image in the box

<input type="button" value="Sign Up" href="sign-up.html" rel="facebox[.body]">
Loads the sign-up.html page

### Using facebox programmatically

Expand Down
8 changes: 6 additions & 2 deletions src/facebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@

// support for rel="facebox.inline_popup" syntax, to add a class
// also supports deprecated "facebox[.inline_popup]" syntax
var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)

var rel = $(this).attr('rel')
var href = $(this).attr('href')

var klass = rel.match(/facebox\[?\.(\w+)\]?/)
if (klass) klass = klass[1]

fillFaceboxFromHref(this.href, klass)
fillFaceboxFromHref(href, klass)
return false
}

Expand Down