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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:18:51+00:00 2026-05-23T21:18:51+00:00

I have a drag-and-droppable control on my page. It has a client-side event ‘OnClientDragging’

  • 0

I have a drag-and-droppable control on my page. It has a client-side event ‘OnClientDragging’ which I am using to provide highlighting to my page. The idea is that there are various zones on the page and, as the user drags the control over parts of the page, the page gets highlighted accordingly.

The problem is that I see the highlighting flicker slightly when moving fast. I do not see any exceptions being thrown, but if I move the mouse rapidly while staying inside of one ‘zone’ I still see the highlighting being removed and re-added. I can only assume this is because the method is not completing in time — and fires again due to being dragged more.. which causes unintended issues?

function RemoveHighlighting(dockZone) {
    if (dockZone.get_docks().length == 0) {
        dockZone.removeCssClass("zoneDropOk");
    }
}

function AddHighlighting(dockZone) {
    if (dockZone.get_docks().length == 0) {
        dockZone.addCssClass("zoneDropOk");
    }
}

var previousZone = null;
//Evaluates whether the currently moused-over item is a RadDockZone.
function TryGetZoneFromTarget(target) {
    while (target != null && target.id) {
        if (target.id.indexOf("RadDockZone") != -1) {
            return $find(target.id);
        }
        target = target.parentNode;
    }
    return null;
}

//Adds highlighting to the dockZones when the user is dragging objects to the screen.
//Clear the old dockZone as the user moves out of it, and color new ones as they move into it.
function OnClientDragging(sender, eventArgs) {
    var target = eventArgs.get_htmlElement();
    var zone = TryGetZoneFromTarget(target);

    if (zone) {
        var currentZone = zone;
        dockZoneDroppedOnID = zone.get_id();

        if (previousZone == null) {
            previousZone = currentZone;
            $.queue(AddHighlighting(currentZone));
        }
        else if (previousZone != currentZone) {
            $.queue(RemoveHighlighting(previousZone));
            previousZone = currentZone;
            $.queue(AddHighlighting(currentZone));
        }
    }
    else {
        dockZoneDroppedOnID = "";
        if (previousZone != null && $.queue.length == 0) {
            RemoveHighlighting(previousZone);
            previousZone = null;
        }
    }
}

Should I be trying to make this script more efficient, or maybe setting a variable outside the local scope to indicate that the previous event is still running and cancel the current event?

EDIT: I’ve edited in a queue solution which worked well! I’m not sure if it’s a perfect solution, but it solved my issue.

  • 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-23T21:18:52+00:00Added an answer on May 23, 2026 at 9:18 pm

    I think setting variables outside this scope will be a more effective approach, in particular, you can either make use of or emulate the way jQuery’s fx queue works.

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

Sidebar

Related Questions

I have Drag/Drop functionality in my page embedded using YAHOO.js which is initalized at
i have a treview control with drag&drop functionality that response to draw the node
I have a problem: I've add a Jquery UI drag-n-drop widget to my page,
I have a datagrid which is populated with CSV data when the user drag/drops
I have the code below that makes a list of div's drag and droppable,
I am using jquery drag-and-drop and I have 3 divs. I want the gallery
I have web page in ASP.NET. I have created Tree View control with jQuery.
I have done drag and drop work using with jquery plug-in, Jquery: $(document).ready(function() {
i have done drag and drop using with jquery. here i have issue that
I have draggable elements which can be dropped in droppable areas. If an element

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.