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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:00:50+00:00 2026-05-26T11:00:50+00:00

I currently am using a script that executes a fade effect when mousing over

  • 0

I currently am using a script that executes a fade effect when mousing over icons (It fades them from color to black and white). I’m having issues with it not working properly on an iPad or iPhone because of the hover event.

Is there any way to wrap the following in a conditional that will exclude an iPad, iPhone and possibly even a droid device from running it?

    <script>
            $(document).ready(function() {
            $("ul.gallery li").hover(function() { //On hover...
            $(this).siblings().each(function () {
                var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
                    //Set a background image(thumbOver) on the &lt;a&gt; tag
                $(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
                    //Fade the image to 0
                    $(this).find("span").stop(false,false).fadeTo('normal', 0 , function() {
                    $(this).hide() //Hide the image after fade
                        });
                });
            } ,
            function() { //on hover out...
                $(this).siblings().each(function () {
                        //Fade the image to 1
                    $(this).find("span").stop(false,false).fadeTo('normal', 1).show();
                    });
                    });
            });
    </script>

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-05-26T11:00:50+00:00Added an answer on May 26, 2026 at 11:00 am

    you can check for ‘iPad’ using navigator.platform:

    // Is the user on an iPad?
    var isIpad = navigator.platform.toLowerCase() === "ipad";
    

    similarly, you can check for other iDevices using an object literal and the in operator:

    // Is the user on an iDevice?
    var isIDevice = navigator.platform.toLowerCase() in {
        "ipod": true,
        "ipad": true,
        "iphone": true
    };
    

    to keep your code from running under these conditions, you can keep your setup logic above in a named function and execute it conditionally on DOM-ready, such as:

    <script type="text/javascript">
    (function() {
    
        // Setup routine
        var ready = function() {
            $("ul.gallery li").hover(function() { //On hover...
                $(this).siblings().each(function () {
                    var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
                    //Set a background image(thumbOver) on the &lt;a&gt; tag
                    $(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
                    //Fade the image to 0
                    $(this).find("span").stop(false,false).fadeTo('normal', 0 , function() {
                        $(this).hide() //Hide the image after fade
                    });
                });
            },
            function() { //on hover out...
                $(this).siblings().each(function () {
                    //Fade the image to 1
                    $(this).find("span").stop(false,false).fadeTo('normal', 1).show();
                });
            });
        };
    
        // Current platform
        var platform = navigator.platform.toLowerCase();
    
        // List of iDevice platforms
        var iDevices = {
            "ipod": true,
            "ipad": true,
            "iphone": true
        };
    
        /*
        // OPTION 1:
        // On DOM-ready, execute for everthing except iPad
        $(function() {
            if ( platform !== "ipad" ) {
                ready();
            }
        });
        */
    
        // OPTION 2
        // Only execute if not an iDevice
        $(function() {
            if ( !(platform in iDevices) ) {
                ready();
                $(window).resize(function () {
                    viewportSize();
                });
            }
        });
    
    })();
    

    to be honest, i’ve never done android detection, but there should be a similar method.

    hope that helps! cheers.

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

Sidebar

Related Questions

I have an IronPython script that looks for current running processes using WMI. The
I am currently using Net::HTTP in a Ruby script to post files to a
I'm currently using the toprettyxml() function of the xml.dom module in a Python script
Currently I am using MySQLi to parse a CSV file into a Database, that
Hey guys currently I am thinking of serving images using an image handler script.
I have a SQL script that is being executed in TOAD. Currently, I have
We're currently using RightScale, and every time we deploy, we execute a script on
I have an Ant script that I would like to execute using a button
I'm trying to write a perl script that determines which users are currently logged
How to Execute VB Script from VC++ and pass parameters to that VB 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.