Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7607435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:39:42+00:00 2026-05-31T00:39:42+00:00

I am using PrettyPhoto lightbox, and trying to set a rel attribute on a

  • 0

I am using PrettyPhoto lightbox, and trying to set a rel attribute on a link when another non-jQuery javascript library makes that link active (it sets the links class to active) so the PrettyPhotot lightbox will open. I don’t want the link to open unless it is an active link. I am successful in setting the attribute, but every link opens in the lightbox when clicked, not just the active one. No errors in FireBug.

Prettyphoto’s code is set as so:

$("a[rel^='prettyPhoto']").prettyPhoto();

The other javascripts code for the active and inactive click:

ContentFlowConf: {
    onclickActiveItem: function (item) {
        $('.active').attr('rel', 'prettyPhoto');
    },
    onclickInactiveItem: function (item) {
    $('.active').removeAttr('rel');
        $('.item').click(function(event) {
            event.preventDefault(); 
        });
    }
}

The initial html is:

 <a class="item" title="Image" href="image.jpg"><img class="content" src="thumb.jpg" alt="Image"/></a>

The other javascript sets the html to:

 <a class="item active" title="Image" href="image.jpg"><img class="content" src="thumb.jpg" alt="Image"/></a>

I am of course a novice and not sure what will make it work. I am wondering if the .live function might need to be used?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:39:44+00:00Added an answer on May 31, 2026 at 12:39 am

    Solved this a follows:

    onclickActiveItem : function(){
        initCBox();
    },
    
    //lots of code here...
    
    function initCBox(){
        var img1 = $('.item.active').attr('href');
        var label = $('.item.active .content').attr('alt');
        $.prettyPhoto.open(img1, label);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using prettyphoto jquery plugin for lightbox. When somebody clicks on a link it
I am using the fantastic PrettyPhoto Lightbox, a Jquery lightbox clone. To launch a
I was trying to add popup helpers on my page using prettyPhoto ( link
I am opening a an ajax window using prettyPhoto: http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/ This is my link
Using Bootstrap's typeahead javascript plugin, I'm attempting to change the data-source attribute via jQuery's
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
I'm using the PrettyPhoto jQuery plugin for an image gallery, and I'd like to
We are using two scripts at the same time: prettyPhoto and jQuery pagination .
Using jQuery UI Resizable I'm trying to prevent resizing based on various rules. The
I am using jquery prettyphoto 2.5.3 and I was wondering how I can get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.