Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery hover function and click through on tablet
    primarykey
    data
    text
    <p>I have a jquery slideshow that that uses a navigation list to switch out the slideshow images. How it works is when you hover over the nav list it highlights ('.active') and the associated image switches to that. There are links inside the nav list which can also be clicked to go to a different page.</p> <p>I need this to work on a tablet so that when the person taps the nav list, it becomes active, then the image slideshow switches, then if you tap again it follows through to that link. Right now what is happening is that as soon as you tap it, it becomes active AND clicks through.</p> <p>Here's the jquery</p> <pre><code>$(".main_image .desc").show(); //Show Banner $(".main_image .block").animate({ opacity: 0.8 }, 1 ); //Set Opacity //Click and Hover events for thumbnail list $(".image_thumb ul li:first").addClass('active'); $(".image_thumb ul li").hover(function(e){ //Set Variables e.preventDefault(); var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image var imgTitle = $(this).find('a.imgloc').attr("href"); //Get Main Image URL var imgDesc = $(this).find('.block').html(); //Get HTML of block var imgDescHeight = $(".main_image").find('.block').height(); //Calculate height of block if ($(this).is(".active")) { //If it's already active, then... return false; // Don't click through } else { //Animate the Teaser $(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250, function() { $(".main_image .block").html(imgDesc).animate({ opacity: 0.8, marginBottom: "0" }, 250 ); $(".main_image img").attr({ src: imgTitle , alt: imgAlt}); }); } $(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists $(this).addClass('active'); //add class of 'active' on this list only return false; }); </code></pre> <p>And here's the html for the nav list</p> <pre><code>&lt;div class="image_thumb"&gt; &lt;ul&gt; &lt;li id="one"&gt; &lt;h2&gt;&lt;a href="styleguide.html"&gt;Text Text Text&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;&lt;a href="styleguide.html"&gt;Text Text Text&lt;/a&gt;&lt;/p&gt; &lt;a class="imgloc" href="content/images/home/01.jpg"&gt;&lt;/a&gt; &lt;div class="block"&gt; &lt;p&gt;Text Text Text&lt;/p&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Here is an example of how it works: <a href="http://ocgoodwill.org" rel="nofollow">ocgoodwill.org</a></p> <p>If anyone can help that would be great!</p> <p>-- EDIT --</p> <p>I also want to add that if a user has tapped onto one of the elements, then taps on a different one, the first one needs to be reset so that if they tap back onto it, it doesn't automatically click through.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload