Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery向上滚动_Jquery_Hover_Jquery Hover_Mousehover_Onhover - Fatal编程技术网

Jquery向上滚动

Jquery向上滚动,jquery,hover,jquery-hover,mousehover,onhover,Jquery,Hover,Jquery Hover,Mousehover,Onhover,我正在编辑我的Jquery滚动脚本,它工作得很好,但我在尝试更改悬停图像时发现了错误,这是我的博客 这是我卷轴脚本中有问题的部分 controlHTML: '<img src="http://2.bp.blogspot.com/-onAd5CVV5QM/UBzbWeBr88I/AAAAAAAAACI/TPBsgVOiEzg/s1600/arrowhover.png" style="width: 55px; height: 54px; " />', controlHTML:“

我正在编辑我的Jquery滚动脚本,它工作得很好,但我在尝试更改悬停图像时发现了错误,这是我的博客

这是我卷轴脚本中有问题的部分

    controlHTML: '<img src="http://2.bp.blogspot.com/-onAd5CVV5QM/UBzbWeBr88I/AAAAAAAAACI/TPBsgVOiEzg/s1600/arrowhover.png" style="width: 55px; height: 54px; " />',
controlHTML:“”,
我想改变这个形象


http://2.bp.blogspot.com/-onAd5CVV5QM/UBzbWeBr88I/AAAAAAAAACI/TPBsgVOiEzg/s1600/arrowhover.png


使用此图像

http://2.bp.blogspot.com/-onAd5CVV5QM/UBzbWeBr88I/AAAAAAAAACI/TPBsgVOiEzg/s1600/arrow.png

只有在悬停时

注意: 我知道如何在HTML和Jquery中更改鼠标上方的图像,但在这种情况下这不起作用,我认为由于在脚本标记中控制HTML,由于您知道如何修复它???或者如果你有其他更好的脚本在Jquery中向上滚动??如果你有……请把它给我:)

我正在使用这个脚本来改变悬停时的图像,它可以工作,但在这里不工作

<img src="http://3.bp.blogspot.com/-Ab63W-gTgs8/UBzbU0TauoI/AAAAAAAAACA/TCVHz200nU4/s1600/arrowhover.png" onmouseover="this.src='http://2.bp.blogspot.com/-onAd5CVV5QM/UBzbWeBr88I/AAAAAAAAACI/TPBsgVOiEzg/s1600/arrow.png'" onmouseout="this.src='http://3.bp.blogspot.com/-Ab63W-gTgs8/UBzbU0TauoI/AAAAAAAAACA/TCVHz200nU4/s1600/arrowhover.png'" style="width: 55px; height: 54px; " />

这是我的整个滚动脚本,如果你想看的话

<script type="text/javascript" >
var scrolltotop={ 
    //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control 
    //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top). 
    setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
    controlHTML: '<img src="http://2.bp.blogspot.com/-onAd5CVV5QM/UBzbWeBr88I/AAAAAAAAACI/TPBsgVOiEzg/s1600/arrowhover.png" style="width: 55px; height: 54px; " />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol" 
    controlattrs: {offsetx:50, offsety:50}, //offset of control relative to right/ bottom of window corner 
    anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
    state: {isvisible:false, shouldvisible:false},
    scrollup:function(){ 
        if (!this.cssfixedsupport) //if control is positioned using JavaScript 
            this.$control.css({opacity:0}) //hide control immediately after clicking it 
        var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto) 
        if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists 
            dest=jQuery('#'+dest).offset().top 
        else 
            dest=0 
        this.$body.animate({scrollTop: dest}, this.setting.scrollduration); 
    },
    keepfixed:function(){ 
        var $window=jQuery(window) 
        var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx 
        var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety 
        this.$control.css({left:controlx+'px', top:controly+'px'}) 
    },
    togglecontrol:function(){ 
        var scrolltop=jQuery(window).scrollTop() 
        if (!this.cssfixedsupport) 
            this.keepfixed() 
        this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false 
        if (this.state.shouldvisible && !this.state.isvisible){ 
            this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0]) 
            this.state.isvisible=true 
        } 
        else if (this.state.shouldvisible==false && this.state.isvisible){ 
            this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1]) 
            this.state.isvisible=false 
        } 
    }, 

    init:function(){ 
        jQuery(document).ready(function($){ 
            var mainobj=scrolltotop 
            var iebrws=document.all 
            mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode 
            mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body') 
            mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>') 
                .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'}) 
                .attr({title:'Scroll Back to Top'}) 
                .click(function(){mainobj.scrollup(); return false}) 
                .appendTo('body') 
            if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text 
                mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text 
            mainobj.togglecontrol() 
            $('a[href="' + mainobj.anchorkeyword +'"]').click(function(){ 
                mainobj.scrollup() 
                return false 
            }) 
            $(window).bind('scroll resize', function(e){ 
                mainobj.togglecontrol() 
            }) 
        }) 
    } 
}
scrolltotop.init()
</script>

var scrolltotop={
//startline:整数。在显示控件之前,从文档滚动条顶部开始滚动的像素数
//scrollto:关键字(整数或“Scroll\u to\u Element\u ID”)。单击控件时向上滚动文档的距离(0=顶部)。
设置:{startline:100,scrollto:0,scrollduration:1000,fadeduration:[500100]},
controlHTML:“”,//control的HTML,自动包装在DIV w/ID=“topcontrol”中
controlattrs:{offsetx:50,offsety:50},//控件相对于窗口右/下角的偏移量
anchorkeyword:“#top”,//在页面上输入HTML锚定的href值,该值还应充当“向上滚动”链接
状态:{isvisible:false,shouldvisible:false},
scrollup:函数(){
if(!this.cssfixedsupport)//如果控件是使用JavaScript定位的
this.$control.css({opacity:0})//单击后立即隐藏控件
var dest=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto)
if(typeof dest==“string”&&jQuery(“#”+dest).length==1)//检查由字符串设置的元素是否存在
dest=jQuery('#'+dest).offset().top
其他的
dest=0
this.$body.animate({scrollTop:dest},this.setting.scrollduration);
},
keepfixed:function(){
var$window=jQuery(窗口)
var controlx=$window.scrollLeft()+$window.width()-this.$control.width()-this.controlattrs.offsetx
变量controly=$window.scrollTop()+$window.height()-this.$control.height()-this.controlattrs.offsety
这个.control.css({left:controlx+'px',top:controly+'px'})
},
togglecontrol:函数(){
var scrolltop=jQuery(窗口).scrolltop()
如果(!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)?true:false
如果(this.state.shouldvisible&!this.state.isvisible){
this.$control.stop().animate({opacity:1},this.setting.fadeduration[0])
this.state.isvisible=true
} 
如果(this.state.shouldvisible==false&&this.state.isvisible){
this.$control.stop().animate({opacity:0},this.setting.fadeduration[1])
this.state.isvisible=false
} 
}, 
init:function(){
jQuery(文档).ready(函数($){
var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws | | iebrws&&document.compatMode==“CSS1Compat”和&window.XMLHttpRequest//不是标准模式下的IE或IE7+浏览器
mainobj.$body=(window.opera)?(document.compatMode==“CSS1Compat”?$('html'):$('body')):$('html,body'))
mainobj.$control=$(''+mainobj.controlHTML+'')
.css({位置:mainobj.cssfixedsupport?'fixed':'absolute',底部:mainobj.controlattrs.offsety,右侧:mainobj.controlattrs.offsetx,不透明度:0,光标:'pointer'})
.attr({title:'Scroll Back to Top'})
.click(函数(){mainobj.scrollup();返回false})
.appendTo('正文')
if(document.all&&!window.XMLHttpRequest&&mainobj.$control.text()!=“”)//检查IE6及以下版本,以及控件是否包含任何文本
mainobj.$control.css({width:mainobj.$control.width()})//IE6-似乎需要在包含文本的DIV上使用显式宽度
mainobj.togglecontrol()
$('a[href=“”+mainobj.anchorkeyword+“]”)。单击(函数(){
mainobj.scrollup()
返回错误
}) 
$(窗口).bind('scroll resize',函数(e){
mainobj.togglecontrol()
}) 
}) 
} 
}
scrolltotop.init()

没有。我没有在console/firebug中报告任何错误!它在简单的JQuery中工作得很好,但在这里不起作用!!