【发布时间】:2012-11-19 02:21:34
【问题描述】:
如何调用这个函数 onLoad 到一个 url?
function fadeLoop() {
var counter = 0,
divs = $('.fader').hide(),
dur = 500;
function showDiv() {
divs.fadeOut(dur) // hide all divs
.filter(function(index) {
return index == counter % divs.length;
}) // figure out correct div to show
.delay(dur) // delay until fadeout is finished
.fadeIn(dur); // and show it
counter++;
}; // function to loop through divs and show correct div
showDiv(); // show first div
return setInterval(function() {
showDiv(); // show next div
}, 5 * 1000); // do this every 5 seconds };
$(function() {
var interval;
$("#start").click(function() {
if (interval == undefined){
interval = fadeLoop();
$(this).val("Stop");
}
else{
clearInterval(interval);
$(this).val("Start");
interval = undefined;
}
}); });
此功能激活我的交互式工具提示;但是,我不知道如何调用它,而且我需要将它放在标题或页面中吗?脚本在页面上,链接在标题上...想法?
提前致谢。
克里斯
【问题讨论】:
标签: javascript html css function call