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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:31:29+00:00 2026-06-12T03:31:29+00:00

How do I open fancybox via manual call for a gallery in the html

  • 0

How do I open fancybox via manual call for a gallery in the html not via the jquery options?

This answers the question of opening the gallery manually.

However, what if I want to open a specific image in a gallery? It could be any image in the gallery list. Is there a way to do that?

I have tried this

$("#launcher").on("click", function(){
 $(".fancybox.default").eq(0).trigger("click");
});

where I add an additional class “default” for the image I want to show.

but when I run it, it shows that image but doesn’t have next/prev button for gallery.

  • 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-12T03:31:31+00:00Added an answer on June 12, 2026 at 3:31 am

    You have to simulate a click on the element you want to focus.

    JQuery lets you do this with the .click function (link).

    I took the example an let it focus on element of the group.
    The first method uses the same selector, fancybox used to create the group

    <script>
        $(document).ready(function(){
            //get the group of your fancy elements
            var fancygroup = $("a[rel=example_group]");
            
            // get the element you want to focus (e.g the first element)
            var fancyelem = $(fancygroup.get(1));
            
            // simulate a click
            fancyelem.click();
        });
    </script>
    

    Alternitvly you can assign an ID to the element you want to focus and simulate a click on it

    <p>
        Image gallery (ps, try using mouse scroll wheel)<br />
    
        <a rel="example_group" href="./example/9_b.jpg" title="Lorem ipsum dolor sit amet"><img alt="" src="./example/9_s.jpg" /></a>
    
        <a rel="example_group" href="./example/10_b.jpg" title=""><img alt="" src="./example/10_s.jpg" /></a>
    
        <a id="initthis" rel="example_group" href="./example/11_b.jpg" title=""><img alt="" src="./example/11_s.jpg" /></a>
        
        <a rel="example_group" href="./example/12_b.jpg" title=""><img class="last" alt="" src="./example/12_s.jpg" /></a>
    </p>
    

    (id assigned to the thrid a element

    and then select the element directly:

    <script>
        $(document).ready(function(){   
            $('#initthis').click();
        });
    </script>
    

    BR,
    Stefan

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my code to open a Fancybox that loads a page via ajax:
I open a html page with a myApp.js included like this: <html> <body> ......
I am using fancybox to open submitted form like this: <form name=form id=myForm action={$smarty.server.PHP_SELF}?action=abc
Using JQuery, I am loading a div from an external HTML page into fancybox
From one page, I call fancybox to open an iframe in the fancybox. From
FancyBox does not open in IE7 on a site I am working on. Is
I am using the fancybox plugin to open up an html file in the
Is it possible to open fancybox window from within the html? meaning: <button onclick=(open
Ok I had asked a question before about how to open fancybox from an
I am triggering the fancybox to open onclick like this: $('.telefonosOtrosPaises').fancybox({ 'type' : 'iframe',

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.