Javascript Wordpress中的JQuery效果(非插件)
我正在尝试更改Jquery行为,并将其添加到wordpress网站 我想做的第一件事是,每当我通过导航点击一个页面时,我希望该页面淡入淡出,然后使页面看起来好像已向上滚动。我可以让fase工作,但我不能让页面向上滚动,或者至少有效果Javascript Wordpress中的JQuery效果(非插件),javascript,jquery,effects,Javascript,Jquery,Effects,我正在尝试更改Jquery行为,并将其添加到wordpress网站 我想做的第一件事是,每当我通过导航点击一个页面时,我希望该页面淡入淡出,然后使页面看起来好像已向上滚动。我可以让fase工作,但我不能让页面向上滚动,或者至少有效果 <script language="Javascript"> $(document).ready(function(){ $('body').fadeIn(1000); }); </script> $
<script language="Javascript">
$(document).ready(function(){
$('body').fadeIn(1000);
});
</script>
$(文档).ready(函数(){
$(‘body’).fadeIn(1000);
});
第二个问题是,我有一个图像,当你在上面扮演角色时,它会显示图像中的标题,我希望它淡入,但会向上滚动标题
<script type="text/javascript">
$(document).ready(function() {
//move the image in pixel
var move = -15;
//zoom percentage, 1.2 =120%
var zoom = 1.1;
//On mouse over those thumbnail
$('#client-rank .client-img').hover(function() {
//Set the width and height according to the zoom percentage
width = $('#client-rank .client-img').width() * zoom;
height = $('#client-rank .client-img').height() * zoom;
//Move and zoom the image
$(this).find('#client-rank .client-img img').stop(false,true)
.animate({
'width': width,
'height': height,
'top': move,
'left': move
}, {duration:200});
//Display the caption
$(this).find('div.caption').stop(false,true).fadeIn(200);
},
function() {
//Reset the image
$(this).find('img').stop(false,true)
.animate({
'width': $('.item').width(),
'height': $('.item').height(),
'top': '0',
'left': '0'
}, {duration:100});
//Hide the caption
$(this).find('div.caption').stop(false,true).fadeOut(200);
});
});
</script>
$(文档).ready(函数(){
//以像素为单位移动图像
var-move=-15;
//缩放百分比,1.2=120%
var zoom=1.1;
//把鼠标放在那些缩略图上
$('#client rank.client img').hover(函数(){
//根据缩放百分比设置宽度和高度
宽度=$('#client rank.client img').width()*缩放;
高度=$('#client rank.client img').height()*缩放;
//移动并缩放图像
$(this).find('#client rank.client img img').stop(false,true)
.制作动画({
“宽度”:宽度,
“高度”:高度,
“顶部”:移动,
“左”:移动
},{持续时间:200});
//显示标题
$(this).find('div.caption').stop(false,true).fadeIn(200);
},
函数(){
//重置图像
$(this).find('img').stop(false,true)
.制作动画({
'宽度':$('.item').width(),
'高度':$('.item').height(),
“顶部”:“0”,
“左”:“0”
},{持续时间:100});
//隐藏标题
$(this).find('div.caption').stop(false,true).fadeOut(200);
});
});
[链接]http://test-cocoonfxmedia.co.uk/elevate/clients!代码>
任何建议都将不胜感激。请在每篇文章中只问一个问题。你也应该告诉我们你试过什么,什么不起作用。例如,在淡入后让页面向上滚动的第一个问题并没有显示任何代码试图实现这一点。让我们看看你尝试了什么。好的,我正在尝试在鼠标悬停上获得向上滚动的效果$(document).ready(function(){$('#client rank.client img').mouseover(function(){$(this).find('div.caption').stop(false,true).slideUp('slow').fadeIn(500);$('#client rank.client img').mouseleave(function(){$(this).find('div.caption').stop(false,true).fadeOut(200);});标题本来是要向上滑动和淡入的,但却变得疯狂和不停。在这里,我尝试使用scrollDown,它可以工作。