Jump to content

[SOLVED] Hide product description initially but show when mouse click on 'More info'


Recommended Posts

Thanks Shailendra, it works perfectly.
How if I want it be hide again if i click on "More info" again?

<script type="text/javascript">
$(document).ready(function(){
	$("#more_info_sheets").hide();
	$("a#more_info_tab_more_info").click(function(){
		$("#more_info_sheets").show();
	});
        $("a#more_info_tab_more_info").click(function(){
		$("#more_info_sheets").hide();
	});
});
</script>

I made this, not work~

Link to comment
Share on other sites

use this Modified script

<script type="text/javascript">
$(document).ready(function(){
	$("#more_info_sheets").hide();
	$("a#more_info_tab_more_info").click(function(){
		$("#more_info_sheets").toggle();
	});
});
</script>

Also as vekia suggested above,you should hide your div having id=more_info_sheets with css display:none initially which will hide your div during page load(for better user experience) instead of after complete page loading.In that case you don't need to add the line $("#more_info_sheets").hide();

Link to comment
Share on other sites

Thanks Shailendra and Vekia for explanation, now I understand what Vekia mean...

So I should add

#more_info_sheets {
	display:none;
}

into Themes -> default -> css -> product.css              in any line, to perform this, am I correct?

Link to comment
Share on other sites

Thanks Shailendra and Vekia for explanation, now I understand what Vekia mean...

 

So I should add

#more_info_sheets {
	display:none;
}

into Themes -> default -> css -> product.css              in any line, to perform this, am I correct?

rather than using this in product.css, you may use inline css so that it will take higher precedence than any other css applied on the same element. so apply this css in product.tpl

<div id="more_info_sheets" class="sheets align_justify" style="display:none;">

and the final script would be

<script type="text/javascript">
$(document).ready(function(){
	$("a#more_info_tab_more_info").click(function(){
		$("#more_info_sheets").toggle();
	});
});
</script>
Link to comment
Share on other sites

  • 2 years later...
×
×
  • Create New...