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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:58:58+00:00 2026-05-21T06:58:58+00:00

My script: (function($){ $.fn.megaswitcher = function(settings) { return this.each(function() { var $i = $(this),

  • 0

My script:

(function($){
$.fn.megaswitcher = function(settings) {
    return this.each(function() {        
        var $i = $(this),
            current,
            childs = $i.find('.selection li').length; // returns desired number

        $i.find('.selection li').delegate('.active', 'dblclick', function(e){
            e.preventDefault();
            current = $i.find('.selection li').index(this);
            alert('triggered @ ' + current); // doesn't even execute
            var _delay = $(this).attr('name') > 0 ? (parseInt($(this).attr('name')) * 1000) : 5000;
            $(this).delay(_delay).show(0, function(){
                if((current + 1) < childs){ // if not last
                    $(this).removeClass('active').next().addClass('active').show(0, function(){
                        $i.find('.image img').addClass('tempp');
                        $(this).find('img').clone().hide().addClass('temp').appendTo($i.find('.image')).fadeIn(400, function(){
                            $i.find('.image img.tempp').remove();
                        });
                    }).trigger('dblclick');
                }else{
                    $(this).removeClass('active');
                    $i.find('.selection li:first').addClass('active').show(0, function(){
                        $i.find('.image img').addClass('tempp');
                        $(this).find('img').clone().hide().addClass('temp').appendTo($i.find('.image')).fadeIn(400, function(){
                            $i.find('.image img.tempp').remove();
                        });
                    }).trigger('dblclick');
                }
            });
        });

        $i.find('.selection li.active').trigger('dblclick');
    });     
};
})(jQuery);

Gotta admit, that, that’s a huge mess over there, but I have no idea why that delegate is not working…

Any ideas?

P.S. I have a different plugin based on this same technique with dblclick, that works flawlessly, except, it doesn’t do item selection with find();, and I have a feeling that it’s the thing that’s causing the problem, but I don’t know with that to replace it.

Thanks in advance!

  • 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-21T06:58:59+00:00Added an answer on May 21, 2026 at 6:58 am

    You have to call delegate on the parent of the items that you want to attach the event.
    Instead of:

    $i.find('.selection li').delegate('.active' ...
    

    you should do

    $i.find('.selection').delegate('li.active'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this script: function slideSwitch() { var ae = jQuery('#featured-right a.active'); if (
I have a bash script file which starts with a function definition, like this:
I have put together the following mootools script window.addEvent('domready', function() { var shouts =
This question is simple. What function would I use in a PHP script to
<script src=http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js></script> <script type=text/javascript> function bigtosmalltriangle() { $(this).siblings(div.break).removeClass('triangle3').addClass('triangle1'); setTimeout ( smalltomediumtriangle(), 400 ); }
For example: script.js: function functionFromScriptJS() { alert('inside functionFromScriptJS'); } iframe.html: <html> <head> <script language=Javascript
I have a calc function in java script that takes three integer parameters, following
Can you use the bash getopts function twice in the same script? I have
What I want to do is trigger a function from an extension/GM Script once
Is there any way to have PHP automatically call a function, before a script

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.