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

  • Home
  • SEARCH
  • 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 8502305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:26:52+00:00 2026-06-11T01:26:52+00:00

I’ve been experimenting with ‘mouseenter’ event to an additional mouse hove function over an

  • 0

I’ve been experimenting with ‘mouseenter’ event to an additional mouse hove function over an existing click function, and doesn’t seem to find the correct formula to achieve the intended effect.

Original code:

    $('.navhandle, .navcontainer, #tray-button, .page-template-template-home-php .lines, .single-portfolio .lines').hover(
function(){ $('#supersized img').addClass('resize'); //add class for css3 transitions
$thisid = $(this).attr("id");
$thisclass = $(this).attr("class");
$navnow = $('.navhandle').css('left');

if ($navnow == navhandleinit) {

if (($thisid == 'tray-button')) {
    $('#thumb-tray').stop().animate({bottom : 0}, 300);
}
    $('#prevslide').stop().animate({left: 25 }, 500, 'easeOutCubic');
    $('.navcontainer').stop().animate({ left: -210 }, 500, 'easeOutCubic');
    $('.navhandle').stop().animate({ left: -10 }, 500, 'easeOutCubic');
     $('.mainbody').stop().animate({marginLeft: 10}, 500, 'easeOutCubic', function(){ $('#supersized img').removeClass('resize'); }); //remove css3 transition class after completion
    $('.videowrapper').animate({width: '120%', paddingLeft:0}, 500, 'easeOutCubic');


    $('.nav').fadeOut(500, 'easeOutCubic');

    $('.navhandle').toggleClass("rightarrow");
},function(){ $('#prevslide').stop().animate({left: 245}, 500, 'easeOutCubic');
    $('.navcontainer').stop().animate({ left: 0 }, 500, 'easeOutCubic');
    $('.navhandle').stop().animate({ left: navhandleinit}, 500, 'easeOutCubic');
    $('.mainbody').stop().animate({marginLeft: 220}, 500, 'easeOutCubic', function(){ $('#supersized img').removeClass('resize'); }); //remove css3 transition class after completion
    $('#thumb-tray').stop().animate({bottom : -$('#thumb-tray').height()}, 300);
    $('.videowrapper').animate({paddingLeft: 220, width: '100%'}, 500, 'easeOutCubic');

    $('.nav').fadeIn(500, 'easeOutCubic');

    $('.navhandle').toggleClass("rightarrow");

    $navnow = navhandleinit;
    }

Simply changing ‘click’ to ‘mouseenter’ works on triggering the effect, but not isolating it to specific elements.

The failed attempt:

  jQuery(function($) {

var navhandleinit = $('.navhandle').css('left');
var navwidth = $('.navcontainer').width() + 30;
var mainmargin = $('.mainbody').css('margin-left');
var $navnow = $('.navhandle').css('left');
var navtray = $('#thumb-tray').css('left');

$('.navhandle, .navcontainer').mouseenter(function() {

$('#supersized img').addClass('resize');
$thisid = $(this).attr("id");
$thisclass = $(this).attr("class");
$navnow = $('.navhandle').css('left');

if ($navnow == navhandleinit) {

if (($thisid == 'tray-button')) {
    $('#thumb-tray').stop().animate({bottom : 0}, 300);
}
    $('#prevslide').stop().animate({left: 25 }, 500, 'easeOutCubic');
    $('.navcontainer').stop().animate({ left: -210 }, 500, 'easeOutCubic');
    $('.navhandle').stop().animate({ left: -10 }, 500, 'easeOutCubic');
     $('.mainbody').stop().animate({marginLeft: 10}, 500, 'easeOutCubic', function(){ $('#supersized img').removeClass('resize'); }); //remove css3 transition class after completion
    $('.videowrapper').animate({width: '120%', paddingLeft:0}, 500, 'easeOutCubic');


    $('.nav').fadeOut(500, 'easeOutCubic');

    $('.navhandle').toggleClass("rightarrow");



} else {

    $('#prevslide').stop().animate({left: 245}, 500, 'easeOutCubic');
    $('.navcontainer').stop().animate({ left: 0 }, 500, 'easeOutCubic');
    $('.navhandle').stop().animate({ left: navhandleinit}, 500, 'easeOutCubic');
    $('.mainbody').stop().animate({marginLeft: 220}, 500, 'easeOutCubic', function(){ $('#supersized img').removeClass('resize'); }); //remove css3 transition class after completion
    $('#thumb-tray').stop().animate({bottom : -$('#thumb-tray').height()}, 300);
    $('.videowrapper').animate({paddingLeft: 220, width: '100%'}, 500, 'easeOutCubic');

    $('.nav').fadeIn(500, 'easeOutCubic');

    $('.navhandle').toggleClass("rightarrow");

    $navnow = navhandleinit;
}

});

});

How can I effectively add a mouseenter event, and optionally, a swipe event for tablets, while maintaining the original click event function?

Live page available at http://stage.daylight.pro.

I’d appreciate your help, 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-11T01:26:54+00:00Added an answer on June 11, 2026 at 1:26 am

    I’m not sure if this was just omitted from your code here, but neither of your examples close the hover() and mouseenter() methods.
    Your failed attempt should end with a ); like

    $('.navhandle, .navcontainer').mouseenter(function() { ... });
    

    Aside from that, I’m not sure why your hover() or mouseenter() methods would affect any click methods defined (unless something in the click() function specifically overrides something in your hover() function).

    UPDATE:
    If I’m understanding you, you have the following parameters/goals:

    1. Existing code within a jQuery hover function
    2. You’d like to keep that intact, but add an additional mouseenter function
    3. There’s also an existing click function that you’d like to maintain as well
    4. Also, you want touch users to experience hover and click functions instead of just click only (since touch users experience hover and click at the same instant)

    As far as the mouseenter vs. hover. I would make it a little cleaner for yourself (and other developers) and separate out the functions. Rather than defining anonymous functions within the hover parameters, say something like:

    $('myDiv').hover(hoverIn, hoverOut);
    function hoverIn() { ... }
    function hoverOut() { ... }
    

    This way you can more easily see your over and out code distinctly. Also, this is better for reuse if you want another function to, say, disable it’s call.

    Your hover, mouseenter, and mouseout function should not get in the way of click events. With each interaction, you will have both mouseenter and click happen in succession.

    Maybe use jQuery mobile for tap event that will suspend the click momentarily. Ultimately, though, the hover event is only a nicety and it would most likely annoy people on touch devices to have to wait momentarily while your hover event fires before firing the click event.

    Hope this helps.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.