Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional jQuery
|
BOOK: Professional jQuery
This is the forum to discuss the Wrox book Professional jQuery Cesar Otero, Rob Larsen; ISBN: 978-1-1180-2668-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2012, 03:00 AM
Registered User
 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to have one effect for some divs simultaneously

Hi.
I have some div element that their ids are 1,2,3,...
These div s have internal div s which their dispaly property are none and their ids are 1_d,2_d,3_d,... according to thir external div,for example internal div for div with id:1 is 1_d.
I want to show internal divs when mouseenter event is applied.
when I do like below codes,it is ok:

Code:
$("#" + 1).mouseenter(function () {
        $("#" + 1 + '_d').stop(true, true).show('clip');
    }).mouseleave(function () {
        $('#' + 1 + '_d').stop(true, true).hide('clip');
    });
    $("#" + 2).mouseenter(function () {
        $("#" + 2 + '_d').stop(true, true).show('clip');
    }).mouseleave(function () {
        $('#' + 2 + '_d').stop(true, true).hide('clip');
    });
but when i want to use "for" it has problem:

Code:
for (var i = 1; i < 3; i++) {
            var item_d = count + '_d';
            $("#" + i).mouseenter(function () {
                $("#" + item_d).stop(true, true).show('clip');
            }).mouseleave(function () {
                $('#' + item_d).stop(true, true).hide('clip');
            });
        }
what can I do in order to use "for" instead of writing them separately?
Another question is that in Fire Fox,when my mouse over a div ,this effect execute repeatedly until mouse leave the div,this problem is just is Fire Fox,what can i do to prevent executing this effect repeatedly?
Please help me.
Thanks in advance.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating 2 tables simultaneously sophia ASP.NET 3.5 Basics 1 September 30th, 2010 08:18 AM
Scrolling ListViews simultaneously. Saju_K .NET Framework 1.x 0 April 27th, 2007 01:50 AM
divs inside divs: theory? Giant_robot_sandwich CSS Cascading Style Sheets 11 September 13th, 2006 03:56 PM
Send/Insert data simultaneously osemollie Pro PHP 1 February 1st, 2006 05:57 AM
Appending names to the textarea simultaneously java_addict Java GUI 2 May 6th, 2005 03:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.