【发布时间】:2016-04-06 16:58:59
【问题描述】:
/* css for button to change size on click */
.button:focus {
width: 99%;
height: 500px;
}
//below is the script that handles the auto scroll to the button clicked on screen.
$(document).ready(function () {
$('.button').click( function() {
$('html,body').animate({ scrollTop: $(this).offset().top - (($(window).height()/1.5) - $(this).outerHeight(true) ) / 2 }, 2000);
$(this).empty(); //empty title and author to prepare for recipe
$(this).append("Recipe Instructions Below");
});
});
在我正在构建的网站上,我将添加到数据库中的最新信息提取出来,并在可点击的按钮中显示每一行。我的目标是按钮从大约 100 像素 x 60 像素开始,单击时“聚焦”将增长到屏幕的宽度。
现在,当我单击按钮时,我想清空按钮并将其替换为数据库中的更多信息,即单击的配方说明。然后,当我松开焦点或单击按钮时,我希望它返回到仅显示配方名称和作者的原始状态。
我的看法是按钮是对象,但我认为这是非常错误的。如果可能的话,任何人都可以给我任何关于智能和更有效方法的反馈,因为我唯一的问题是在单击时向按钮添加更多元素。如果有任何反馈,我将不胜感激。
【问题讨论】:
标签: php html css button element