Images with lightbox effect

Hi,

I want to have a lightbox effect for images.

I added to the link in a blog entry:

<a class="elgg-lightbox" ...

and
    elgg_load_js('lightbox');
    elgg_load_css('lightbox');

to Aalborg-Theme-Init.

=> no lightbox

How does that work ?

  • I wanted to edit a blog entry but CKEditor removes class="elgg-lightbox" from the link <a ...

    How can I configure CKEditor that it does not remove class="elgg-lightbox" ?

     

  • It's not the CKEditor that removes it but the HTMLawed plugin. All "class" attributes are removed from input for security reasons.

  • what's so dangerous about "class" ?

  • and what about lightbox effect ?

  • what's so dangerous about "class" ?

    For one thing classes are often used as jquery selectors for triggering any number of actions.  Allowing arbitrary classes to be added to things by anyone could potentially mess up the javascript on the page.  Also styling - this isn't a platform with a small number of trusted content creators that know what they're doing.  A social network by definition is many content creators pushing content to many people.  Do you really want someone reusing classes in user-defined content.

    If you're using some admin-only action for a CMS-like feature you can certainly disable filtering for those inputs/outputs assuming you are trusting the content.

  • If I add 'class="elgg-lightbox"' to the link then a lightbox is opened, but the image is displayed with nonsens data. It seems not to recognize that it is an image.

     

    <a class="elgg-lightbox-photo"

    That looks good ...

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking