実行するには数秒かかるタイピングアニメーションのプラグインがあります。非常にボタンが表示されます。アンカーリンクへスムーズにスクロールし、URLからアンカーを取り除く機能もあります。ドキュメントの準備ができたらスクリプトを入力し、ウィンドウが読み込まれたらスクロール機能をロードします。私が抱えている問題は、入力プラグインのアンカーリンクをクリックするとスクロール機能が起動しないということです。また、入力プラグインの後にスクロール機能を呼び出すことも試みました。私のコードは現在次のようになっています。別のスクリプトが完了した後のjQueryのファイヤー機能
function anchorLinks() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top -1
}, 500);
return false;
}
}
});
};
$(window).load(function(){
anchorLinks();
});
、その後...
$(document).ready(function(){
$('#msg').typeIt({
speed: 50,
breakLines: false,
autoStart: false,
cursor: false,
startDelay: 2000
})
.tiType('Hi!')
.tiPause(1500)
.tiDelete()
.tiType('I\'m Sandra Willford, and welcome to TENDesign.')
.tiPause(1500)
.tiDelete()
.tiType('Looking for a designer that has bright ideas for your brand?')
.tiPause(1500)
.tiDelete()
.tiType('Well congratulations, you\'ve landed in the right spot :)')
.tiPause(1500)
.tiDelete()
.tiType('I specialize in fresh and innovative digital, website & branding designs.')
.tiPause(1500)
.tiDelete()
.tiType('Are you ready to take your brand to the next level?')
.tiPause(1500)
.tiDelete()
.tiType('<a href="#start">OMG, Yes I am!...Show me more.</a>');
anchorLinks();
});
の提案をいただければ幸いです!
だから、あなたが表示するダイアログの最後にレンダリングされたボタンをユーザがクリックした後、ページの上部にスクロールするのですか?また、 'scrollTop()'が何をしていると思いますか、それを行うために必要なことについて説明できますか? – Glubus
まず第一に、これは間違いなく問題を引き起こす可能性があります: 'function scrollTop(){ $ {function(){ $( 'a [href * =#]:not([href =#])')。 (){'$(function(){'と 'と'} 'を削除して、関数内のイベントをbintしないで、代わりに' false false; 'e.preventDefault'を使用してください – vaso123