0
You can make use of.target pseudo-class. For this define next CSS rules:
您可以使用.target伪类。为此定义下一个CSS规则:
HTML:
These are the shoes
CSS:
#shoes {
display: none; /* hide by default */
}
#shoes:target, /* and show either if class show is present (on click) */
#shoes.show { /* or location hash matches id "shoes" */
display: block;
}
and in JS you would add class show:
在JS中你会添加类show:
$(document).ready(function() {
$('.product-highlight').hide();
$('a[href$=shoes').click(function() {
$('#shoes').addClass('show');
});
});
When redirecting from index page you would also need to set a hash #shoes:
从索引页面重定向时,您还需要设置哈希#shoes:
$(document).ready(function() {
$('a[href$=shoes]').click(function() {
window.location.href= 'http://sample.com/products.php/#shoes';
});
});
请参阅此页面
or
$(document).ready(function(){
$(".Test2").hide();
$(".Test1").show();
$('.Test1').click(function(){
$(".Test2").slideToggle();
});
});