Hello,
I want a lightbox to appear when i hit a specific url, not by clicking a link. The link is external.
Example: when someones hits www.example.com/activity/all?ref=twitter in a browser, then it must trigger a lightbox. I have done the following with the help of this community but still i need some help.
// views/default/js/my/twitter/lightbox.js
define(function(require) {
var elgg = require('elgg');
// Pop the lightbox
elgg.lightbox({...}); //this doesn't work
});
// start.php
if (preg_match("/[&\?]ref=twitter(&.*)?/", current_page_url()) {
elgg_require_js('my/twitter/lightbox');
}
Also, above case is for a specific plugin only but i also want to handle whenever a link with ref=twitter is hit, a lightbox must be opened. I don't want to rewrite all the syntax in every plugins.
Thanks in advance.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Team Webgalli@webgalli
Team Webgalli - 1 like
- Steve Clay@steve_clay
Steve Clay - 1 like
- Steve Clay@steve_clay
Steve Clay - 1 like
- Manjul Bhattarai@manjulmanutd
Manjul Bhattarai - 0 likes
- Steve Clay@steve_clay
Steve Clay - 0 likes
You must log in to post replies.You can create a new plugin and with in the init function (in start.php) of the plugin, check for the ref parameter and load the js as needed.
Server side, elgg_load_js('lightbox') and elgg_load_css('lightbox') loads the client-side resources.
In your AMD module, just call $.colorbox(my_options); directly.
At some point loading the script/CSS will be as simple as require('elgg/lightbox'); in your AMD module. Not today :(
Thanks, but in my JS file, how do i call lightbox explicitly?