所以我有這樣的代碼在我的網站的錨jQuery的網頁,在上面這段代碼滾動,但不要打開一個新頁面,當我點擊文本按鈕滾動頂部和錨翻開新的一頁
代碼JS:
$(document).ready(function(){
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
代碼HTML,文本按鈕:
<a href="<?php $url->_getURL1('openpage'); ?>" class="scrollToTop">Domestic Electrical installation</a>
<a href="<?php $url->_getURL2('openpage'); ?>" class="scrollToTop">Comercial Electrical installation</a>
感謝你的幫助
究竟什麼是你的問題打開? – ray9209 2014-10-29 19:51:54
和你的問題是? – bipen 2014-10-29 19:52:57
@ ray9209和bipen,我編輯的問題。 tnx – user3480332 2014-10-29 19:55:46