Jump to content

Highlighter and onclick


HCProfessionals

Recommended Posts

I have this so far, but it isn'tworking...

 

<script type="text/javascript" language="javascript">
    $(document).ready(function() {

      $("#product-image-buy-link").click(function(){
         $("#top-bar-content-items").effect( "highlight", 
          {color:"#FFF"}, 3000 );
      });

   });
   </script>


<span id="top-bar-content-items">You have <span class="cart-quantity">0</span> products in your cart</span>

<span id="product-image-buy-link" class="purchase">add to cart</span>

Link to comment
Share on other sites

HCProfessionals when you want the user to click on something you MUST make that apparent to him/her. I removed your span and made it a button.

I don't know where ".effect()" came from, it's not part of the base jquery and if you got it from an extension module you should have mentioned that.

 

This does not have a fadeOut but it does work. Oh, highlighting  a number is hard to see maybe you want to change that or use drop shadows? What it does is show how to delay a command.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>New document</title>
<script src="./lib/jquery-1.7.2.min.js" type="text/javascript"></script> // My location, yours may be different
<script type="text/javascript" language="javascript">
$(document).ready(function() {

  $("input#CkHere").click(function(){
	var origColor = $('.cart_quantity').css("color");
	$('span.cart_quantity').css({'color': 'red'});
	setTimeout(function() {
	    $('span.cart_quantity').css({'color': 'black'});
	    }, 300);

   });
});
</script>
<style type="text/css">

</style></head><body>
<span class="top_bar_content_items">You have <span class="cart_quantity">0</span> products in your cart</span>
<input type="button" value="add to cart" id="CkHere" />
</body></html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.