Include script after the jQuery library:
jQuery A+ accepts settings from an object of key/value pairs, and can be assigned to any HTML element. See Plugin options below.
<script src="/path/to/jquery.Aplus.js"></script>
Usage:jQuery A+ accepts settings from an object of key/value pairs, and can be assigned to any HTML element. See Plugin options below.
//enable A+ syntax for all A tags inside body element, now or in the future$('body').Aplus();
//enable A+ syntax for the specific A tag$('#link1').Aplus({confirmType:'dialog'});
HTML syntax
class attribute
- ajax
- Replaces the contents of the page with the contents of the url using ajax
- ajax-to-element_id
- Replaces only the contents of the element, with the contents of the url, using ajax
- ajax-from-element_id
- Replaces the contents, with a part of the contents of the url (the element content indicated)
- blank
- Opens the linked document in a new window or tab
- confirm
- Opens the linked document only after user confirmation (used default browser dialog box)
- confirm-html5
- Replace default browser dialog box with <dialog> tag (to customize style)
- confirm-ui
- Replace default browser dialog box with jQueryUI dialog box
- confirm-mask-element_id
- Element that contains text for the confirm dialog.
- dialog
- Open link in a HTML5 dialog or jqueryUI dialog (according to 'dialogType' option) using <iframe>
- dialog-ajax
- Replace <iframe> with Ajax request. Fetch url via Ajax and insert contents in the dialog body
- dialog-full
- Same size of the page
- dialog-modal
- Dialog will have modal behavior
- dialog-w-value
- Dialog width (in pixels or percentage)
- dialog-h-value
- Dialog height (in pixels or percentage)
- dialog-l-value
- The left position of the dialog (in pixels)
- dialog-t-value
- The top position of the dialog (in pixels)
- dialog-option-value
- Support all jQueryUI dialog options (only for jQueryUI dialogs). See jQueryUI dialog demos »
- disabled
- The link is disabled. No rules is performed
- frame
- Opens the linked document in a named frame
- frame-framename
- Name of the frame where the link is open
- notify
- Invoke url using a Ajax GET request and display the server response
- notify-life
- Life time (in seconds) of the notification (default: 10)
- notify-type
- Specifies the type of notification to have appeared (values: empty,growlUI,jGrowl - default:empty)
- parent
- Opens the linked document in the parent frame
- Prints the contents of the current window
- scroll
- Create an anchor animated scroll (anchor links only)
- scroll-speed-value
- Set animated scroll speed
- scroll-offsetY-value
- Add offset value (in px) to the final scroll position
- self
- Opens the linked document in the same frame as it was clicked
- win
- Opens the linked document in a new window popup
- win-center
- Center window in the page
- win-fullpage
- Same size of the page
- win-fullscreen
- Same size of the display
- win-width-value
- Window width (in pixels or percentage)
- win-height-value
- Window height (in pixels or percentage)
- win-left-value
- The left position of the window (in pixels)
- win-top-value
- The top position of the window (in pixels)
- win-scrollbars
- Show the window scrollbars
- win-toolbar
- Show the window toolbar
title attribute
- message
- Text of the confirmation dialog or ID of the element (start with #)
Mask tags
- [href]
- Replaced with content of the href attribute
- [text]
- Replaced with content of the tag
- [title]
- Replaced with content of title attribute
Custom events
- ajaxComplete.aplus
- This event is triggered by the A tag and occurs when the ajax request is completed. Param: response (response content)
- ajaxToComplete.aplus
- This event is triggered by the container tag when the ajax content is appended to the tag. Param: obj (HTML element)
- ajaxError.aplus
- This event occurs when the ajax request fails. Param: textStatus, errorThrown
- ajaxMismatch.aplus
- This event occurs when the ajax request is completed and the response does not contain the expected content. Param: response (response content)
- dialogShow.aplus
- This event occurs when the HTML5 <dialog> is opened
Plugin options
- ajax.loadMsg
- Message displayed when an ajax request is in progress (default: "...")
- confirm
- Default confirm message before to open a link (default: "Are you sure you want to open the link?")
- confirmType
- html5 = override confirm box with HTML5 <dialog> tag, ui = override confirm box with jQueryUI dialog, inline function = override confirm box with custom function, (default empty)
- dialog
- Is same "Options" object of JQueryUI Dialog Widget see JQueryUI API
- dialog.dialogClass
- Class attribute value of the dialog (default: "japlus")
- dialogCloseIcon
- Close icon text for HTML5 <dialog>. False value permits to hide the icon (default: X)
- dialogType
- html5 = using HTML5 <dialog> tag to create dialog, ui = use jQueryUI library to create dialog (default: html5)
- disabledMsg
- false = don't show the alert message in disabled link even if title attribute is present (default "alert")
- notify.life
- Life time (in seconds) of the notification (default: 10)
- notify.type
- empty = alert notification, growlUI (blockUI plugin required),jGrowl (jGrowl plugin required). Default: empty
- prefix
- Use prefix to prevent conflicts between class names (default empty)
- scroll.speed
- int, Number determining how long the animation will run (default 300)
- scroll.offsetY
- int, Value to be added to the Y coordinate of the final position (default 0)
- win.check
- boolean, Adds the class "DISABLED" to the link, during the loading of the window, to prevent multiple clicks on the link. (default true)
- win.width
- int, Window width (default 400)
- win.height
- int, Window height (default 400)
- win.scrollbars
- enum, 1=Show scrollbars, 0=Hide scrolllbars (default 0)
- win.toolbar
- enum, 1=Show browser toolbar, 0=Hide toolbar (default 0)
- win.left
- int, The left position of the window (default 0)
- win.top
- int, The top position of the window (default 0)