Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-12-2011, 04:29 PM   PM User | #1
bluealien
New to the CF scene

 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bluealien is an unknown quantity at this point
Question Converting hover to click

Im trying to convert this code to use Click instead of Hover. I have comment out original hover line //.


How it works, if you "Hover" (want as click) over PLUS(1), its hides PLUS(1) and display a new image(1) and embeds sound(1). If you "Hover" on new PLUS(2), it hides old new image(1) and display new image(2) and embeds sound(2).

If I add Click, it works (removes plus, adds new image and sound) other then when I Click on new PLUS, it does not remove the old image(1) new image (2) and sound(2) works.

So Im looking for a way with "Click" to know how to remove old image(1), hope I was able to explain, thanks for all your ideas and or help


Code:
$(document).ready(function(){qs();$('#my-list').css({'height':newhsHt});
$('#my-list').hoverscroll({fixedArrows:false,rtl:false,width:newhsWth,height:newhsHt});initScroll();initialWidth();
//$("ul.thumb li").hover(function(){for(i=0;i<storyTitles.length;i++){if($(this).attr('id')==storyTitles[i]){populate(storyTitles[i]);}}
$("ul.thumb li").click('click', function(){for(i=0;i<storyTitles.length;i++){if($(this).attr('id')==storyTitles[i]){populate(storyTitles[i]);}}
	if(mousedout==false&&$(this).attr('id')!=qsParm['title']){clearHover();mousedout=true;}
	else if(mousedout==false&&$(this).attr('id')==qsParm['title']){if(count==1){mousedout=true;return;}count++;}
		$(this).css({'z-index':'999999'});tempwth=$(this).find('img').attr('width');tempht=$(this).find('img').attr('height');
		$(this).children('.plus').css({'display':'none'});
		$(this).children('a').children('.cover').addClass("hover").stop().animate({marginTop:hoverVarTmp[0]+px,marginLeft:hoverVarTmp[1]+px,width:hoverVarTmp[2]+px,height:hoverVarTmp[3]+px,padding:'0px'},200);
	if(browser=="Microsoft Internet Explorer"&&os=="Win 7"){document.writeln("<bgsound src='"+hoverVarTmp[4]+"'>");}
	else{$('#sound_element').html("<embed src='"+hoverVarTmp[4]+"' hidden='true' autostart='true' type='audio/mpeg' loop='false'>");}},
	function(){
		$(this).css({'z-index':'0'});
		$(this).children('a').children('.cover').removeClass("hover").stop().animate({marginTop:'0px',marginLeft:'0px',width:'0px',height:'0px',padding:'0px'},400);
		$(this).children('.plus').css({'display':'inline'});});$('ul.thumb #'+qsParm['title']).trigger("mouseover");});
bluealien is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:58 AM.


Advertisement
Log in to turn off these ads.