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 8994437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:25:55+00:00 2026-06-15T23:25:55+00:00

Hi I want to inject an extra data to facybox title function deneme is

  • 0

Hi I want to inject an extra data to facybox title function deneme is the variable that I want to inject with no success.

<a rel="example_group" title="Title comes here" data-deneme="<?php echo $galleryitem['idphotos']; ?>">sdasd</a>

$("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'titlePosition'     : 'over',
            'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                var deneme=$(this).data('deneme');

                return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span><span stye="color:#FFF; cursor:pointer;" onclick="javascript:popUpWindow(&quot;<?php echo base_url();?>selectproductoptions/'+ deneme +'.html&quot;,10,10,660,550);">+ add to cart</span>';
            }
        });

deneme always comes undefined

I figured out how to do that instead of trying to get deneme separately I have put to deneme just after the href like urlofimage.jpg?DenemeComesHere

and to grab deneme I have used jquerys split function like so

var deneme = currentOpts.href.split(‘?’);

Thank you…

  • 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-06-15T23:25:56+00:00Added an answer on June 15, 2026 at 11:25 pm

    If using fancybox v1.3.4 :

    Unfortunately you cannot use $(this) (neither this) to refer to the element from where you invoked fancybox (let’s say it’s a design bug) so you have to refer to the whole selector $("a[rel=example_group]"). To filter the current element, use the currentIndex parameter passed through the titleFormat API function like :

    'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                    var deneme = $("a[rel=example_group]").eq(currentIndex).data('deneme');
                    return '...etc'
    }
    

    … or :

    'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                    var deneme = $("a[rel=example_group]:eq("+currentIndex+")").data('deneme');
                    return '...etc'
    }
    

    … whatever you prefer.

    If using fancybox v2.x+

    You can refer to $(this) using $(this.element)

    In the case of your title, add the variable using the callback beforeShow like :

    $("a[rel=example_group]").fancybox({
      // other API options
      beforeShow: function(){
        var deneme = $(this.element).data('deneme');
        this.title = 'some html' + this.title + 'other html' ... etc
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to inject one additional variable into the context of a view that
I have a function JavaScript that i want to inject in a Html, with
Want to inject a dao that has a configured data source injected into it..
I have a bean that i want to inject with a named list using
I just want to know how can I add the data type here? Google
I want to inject the URL of a classpath resource in a way that
I have a service that I want to inject into multiple client classes. I
I'm using Spring 3 and want to inject some dependencies into a class that
I want to inject a variable into url like in the code. But It
Basically, I want to inject some data into ViewData/ViewBag for every single request.

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.