jQuery问题-未捕获类型错误:无法读取属性';浏览器&x27;未定义的
我正在尝试向网站添加滑块 当我在本地进行测试时,它在标准html文件中工作正常,但当我尝试将其传输到wordpress站点时,我不断遇到以下错误: 未捕获的TypeError:无法读取未定义的属性“browser” 它指向问题代码中的第11行jQuery问题-未捕获类型错误:无法读取属性';浏览器&x27;未定义的,jquery,wordpress,slider,Jquery,Wordpress,Slider,我正在尝试向网站添加滑块 当我在本地进行测试时,它在标准html文件中工作正常,但当我尝试将其传输到wordpress站点时,我不断遇到以下错误: 未捕获的TypeError:无法读取未定义的属性“browser” 它指向问题代码中的第11行 isIE = $.browser.msie, 我不确定发生了什么,因为它在基本文件中工作,而不是wordpress live站点 这是滑块的jquery文件——我确信它很简单,但我还没有弄明白 谢谢 瑞安 var电流=0, imagenum={}, he
isIE = $.browser.msie,
我不确定发生了什么,因为它在基本文件中工作,而不是wordpress live站点
这是滑块的jquery文件——我确信它很简单,但我还没有弄明白
谢谢
瑞安
var电流=0,
imagenum={},
heroName={},
速度=500,
messageDelay=10000,
扩展=假,
设置动画=错误,
easeType='easeOutQuint',
scrollEase='easeInOutExpo',
easeTypeCB='立方贝塞尔(0.770,0.000,0.175,1.000)',
isIE=$.browser.msie,
电流H=0,
动漫=假,
isLoading=false,
自动英雄=“”,
HeroSlideLoad=false,
heroSlideDuration=1000,
gt1000=假,
滚动速度=1000,
scrollAnimation=false,
自动唤醒=真,
heros、winw、heroc、herobtns、herobg、wbTimeout、image2、heromax、currentbg、tabindex、tabDiv、showing、tabLinks、clientList、num、anchor_max、anchors;
$(文档).ready(函数(){
checkHash();
heroCarousel();
});
函数getHash(){
var hash=window.location.hash;
返回hash.substring(1);
}
函数checkHash(){
var currentHash=getHash();
如果(currentHash.length>0){
var-src;
var-projectLink;
if(currentHash.charAt(0)='!'){
src=currentHash.substr(1).replace('-','');
projectLink=$.inArray(src,projectName);
滚动项目((projectLink+1));
}else if(currentHash.charAt(0)='@'){
src=currentHash.substr(1);
projectLink=$.inArray(src,heroName);
如果(项目链接>-1){
loadHero(projectLink);
$('.slider wrapper img').imagesLoaded(函数(){
自动唤醒=假;
});
}
}
}
}
函数getWindowWidth(){
返回$(window.width();
}
功能转盘(自动){
英雄=$(“.hero”);
heroc=$(“#英雄旋转木马”);
herobtns=$('.slider wrapper.pager btn');
herobg=$('.herogmgbg');
heromax=$('.hero')。长度为1;
if(heroc.size()){
$(窗口)。调整大小(函数(){
winw=$(window.width();
heroc.width(winw*(heromax+1));
$('.hero、.herogmgbg').width(winw);
var heroPos=-(winw*(currenth));
如果(isIE){
赫罗克动画({
“左”:heroPos
}, 0);
}否则{
heroc.css({
“-webkit transform”:“translate3d(“+heroPos+”px,0,0)”,
“-moz transform”:“translate(“+heroPos+”px,0)”,
“-o-transform”:“translate(“+heroPos+”px,0)”,
“-ms transform”:“translate(“+heroPos+”px,0)”,
“transform”:“translate(“+heroPos+”px,0)”,
“-webkit转换”:“无”,
“-moz转换”:“无”,
“-o-转换”:“无”,
“-ms转换”:“无”,
“转换”:“无”
});
}
isLoading=false;
动漫=假;
loadHero(currenth);
}).resize();
//上一页/下一页按钮
herobtns.click(函数(){
if($(this).hasClass('next')){
loadHero(“下一个”);
}否则{
loadHero('prev');
}
自动唤醒=假;
返回false;
});
//简单导航按钮
snav.click(函数(){
var ind=$('.simple nav li a')。指数(本);
loadHero(ind);
自动唤醒=假;
返回false;
});
loadHero(0);
}
}
函数loadHero(dir){
如果(!isLoading){
isLoading=true;
如果(dir=='next'){
如果(当前h>=heromax){
电流h=0;
}否则{
电流h++;
}
}否则如果(dir=='prev'){
如果(当前H 1200){
如果(!slide.hasClass('loaded1200')){
幻灯片。removeClass(“已加载”);
$('.tab容器:eq(0)h1').hide();
$(“#微调器”).show();
图像2=$('');
currentbg=$('.mgbg'+currenth);
html(image2);
if(幻灯片查找('.mg').length){
//加载转盘图像
slide.find('.mg')。每个(函数(){
var图像;
如果(getWindowWidth()>1200){
image=$(this.attr('data-src-large')?$(''):$('');
}否则{
图像=$('');
}
$(this).html(图像);
//image.delay(500).animate({'opacity':1},500,easeType);
});
slide.find('img').imagesLoaded(函数(){
改变主题(幻灯片);
slide.addClass('loaded1200');
//旋转木马动画
阿尼希罗(dir);
});
}否则{
改变主题(幻灯片);
slide.addClass('loaded1200');
阿尼希罗(dir);
}
}否则{
改变主题(幻灯片);
阿尼希罗(dir);
}
}否则{
如果(!slide.hasClass('loaded')){
slide.removeClass('loaded1200');
$('.tab容器:eq(0)h1').hide();
$(“#微调器”).show();
图像2=$('');
currentbg=$('.mgbg'+currenth);
html(image2);
if(幻灯片查找('.mg').length){
//加载转盘图像
slide.find('.mg')。每个(函数(){
var图像;
var current = 0,
imagenum = {},
heroName = {},
speed = 500,
messageDelay = 10000,
expanded = false,
animating = false,
easeType = 'easeOutQuint',
scrollEase = 'easeInOutExpo',
easeTypeCB = 'cubic-bezier(0.770, 0.000, 0.175, 1.000)',
isIE = $.browser.msie,
currenth = 0,
anim = false,
isLoading = false,
autoHero = '',
heroSlideLoading = false,
heroSlideDuration = 1000,
gt1000 = false,
scrollSpeed = 1000,
scrollAnimation = false,
autoCarousel = true,
heros, winw, heroc, herobtns, herobg, wbTimeout, image2, heromax, currentbg, tabindex, tabDiv, showing, tabLinks, clientList, num, anchor_max, anchors;
$(document).ready(function(){
checkHash();
heroCarousel();
});
function getHash(){
var hash = window.location.hash;
return hash.substring(1);
}
function checkHash(){
var currentHash = getHash();
if(currentHash.length > 0){
var src;
var projectLink;
if( currentHash.charAt(0) == '!' ){
src = currentHash.substr(1).replace('-', ' ');
projectLink = $.inArray(src, projectName);
scrollToProject((projectLink+1));
} else if( currentHash.charAt(0) == '@' ){
src = currentHash.substr(1);
projectLink = $.inArray(src, heroName);
if(projectLink > -1){
loadHero(projectLink);
$('.slider-wrapper img').imagesLoaded( function(){
autoCarousel = false;
});
}
}
}
}
function getWindowWidth(){
return $(window).width();
}
function heroCarousel(auto){
heros = $('.hero');
heroc = $('#hero-carousel');
herobtns = $('.slider-wrapper .pager-btn');
herobg = $('.heroimgbg');
heromax = $('.hero').length-1;
if(heroc.size()){
$(window).resize(function(){
winw = $(window).width();
heroc.width(winw * (heromax+1));
$('.hero, .heroimgbg').width(winw);
var heroPos = -(winw * (currenth));
if(isIE){
heroc.animate({
'left' : heroPos
}, 0);
} else {
heroc.css({
'-webkit-transform' : 'translate3d(' + heroPos + 'px, 0, 0)',
'-moz-transform' : 'translate(' + heroPos + 'px, 0)',
'-o-transform' : 'translate(' + heroPos + 'px, 0)',
'-ms-transform' : 'translate(' + heroPos + 'px, 0)',
'transform' : 'translate(' + heroPos + 'px, 0)',
'-webkit-transition': 'none',
'-moz-transition': 'none',
'-o-transition': 'none',
'-ms-transition': 'none',
'transition': 'none'
});
}
isLoading = false;
anim = false;
loadHero(currenth);
}).resize();
//previous/next buttons
herobtns.click(function(){
if( $(this).hasClass('next') ){
loadHero('next');
} else {
loadHero('prev');
}
autoCarousel = false;
return false;
});
//simple nav buttons
snav.click(function(){
var ind = $('.simple-nav li a').index(this);
loadHero(ind);
autoCarousel = false;
return false;
});
loadHero(0);
}
}
function loadHero(dir){
if(!isLoading){
isLoading = true;
if( dir == 'next' ){
if( currenth >= heromax ){
currenth = 0;
} else {
currenth++;
}
} else if( dir == 'prev' ) {
if( currenth <= 0 ){
currenth = heromax;
} else {
currenth--;
}
} else {
currenth = dir;
}
var slide = $('#hero-carousel .hero').eq(currenth);
slide.addClass('next-slide');
//load current slide
if(getWindowWidth() > 1200){
if(!slide.hasClass('loaded1200')){
slide.removeClass('loaded');
$('.tab-container:eq(0) h1').hide();
$('#spinner').show();
image2 = $('<img src="'+$('.heroimgbg'+currenth).attr('data-src')+'" alt="" />');
currentbg = $('.heroimgbg'+currenth);
currentbg.html(image2);
if(slide.find('.heroimg').length){
//load carousel images
slide.find('.heroimg').each(function(){
var image;
if(getWindowWidth() > 1200){
image = $(this).attr('data-src-large') ? $('<img src="'+$(this).attr('data-src-large')+'" alt="" />') : $('<img src="'+$(this).attr('data-src')+'" alt="" />');
} else {
image = $('<img src="'+$(this).attr('data-src')+'" alt="" />');
}
$(this).html(image);
//image.delay(500).animate({'opacity': 1},500, easeType);
});
slide.find('img').imagesLoaded(function(){
changeTheme(slide);
slide.addClass('loaded1200');
//animate carousel
animHero(dir);
});
} else {
changeTheme(slide);
slide.addClass('loaded1200');
animHero(dir);
}
} else {
changeTheme(slide);
animHero(dir);
}
} else {
if(!slide.hasClass('loaded')){
slide.removeClass('loaded1200');
$('.tab-container:eq(0) h1').hide();
$('#spinner').show();
image2 = $('<img src="'+$('.heroimgbg'+currenth).attr('data-src')+'" alt="" />');
currentbg = $('.heroimgbg'+currenth);
currentbg.html(image2);
if(slide.find('.heroimg').length){
//load carousel images
slide.find('.heroimg').each(function(){
var image;
if(getWindowWidth() > 1200){
image = $(this).attr('data-src-large') ? $('<img src="'+$(this).attr('data-src-large')+'" alt="" />') : $('<img src="'+$(this).attr('data-src')+'" alt="" />');
} else {
image = $('<img src="'+$(this).attr('data-src')+'" alt="" />');
}
$(this).html(image);
image.delay(500).animate({'opacity': 1},500, easeType);
});
slide.find('img').imagesLoaded(function(){
changeTheme(slide);
slide.addClass('loaded');
//animate carousel
animHero(dir);
});
} else {
changeTheme(slide);
slide.addClass('loaded');
animHero(dir);
}
} else {
changeTheme(slide);
animHero(dir);
}
}
}
}
function changeTheme(slide){
$('.tab-container:eq(0) h1').show();
$('#spinner').hide();
//set theme
if(slide.attr('data-theme')){
$('body').attr('class', 'anchors');
$('body').addClass('theme-' + slide.attr('data-theme'));
}
}
function animHero(dir){
//$('body').css('cursor', 'auto');
if( !anim ){
anim = true;
var finishAnim;
//load background image
var image2src = $('.heroimgbg'+currenth).attr('data-src');
if(currenth !== dir || dir === 0){
currentbg = $('.heroimgbg'+currenth);
$('.heroimgbg').each(function(){
if($(this).css('opacity') > 0){
$(this).animate({'opacity': 0}, heroSlideDuration, easeType);
}
});
currentbg.css('background-image', 'url(' + image2src + ')').delay(500).animate({'opacity': 1}, heroSlideDuration, easeType);
}
//clear classes
$('.hero').removeClass('exit enter fromleft fromright active');
//$('.simple-nav li').removeClass('active');
var currentSlide = $('.hero:eq('+currenth +')');
currentSlide.addClass('enter');
$('.hero:gt('+ currenth +')').addClass('fromright');
$('.hero:lt('+ currenth +')').addClass('fromleft');
/*heroc.animate({
'left' : (currenth * -winw),
leaveTransforms:true
}, heroSlideDuration, 'easeInOutQuint', function(){
anim = false;
isLoading = false;
$('.hero:eq('+currenth +')').addClass('active');
}).css('z-index','20');*/
var heroPos = (currenth * -winw);
if(isIE){
heroc.animate({
'left' : heroPos
}, heroSlideDuration, 'easeInOutQuint', function(){
anim = false;
isLoading = false;
$('.hero:eq('+currenth +')').addClass('active');
});
} else {
heroc.css({
'-webkit-transform' : 'translate3d(' + heroPos + 'px, 0, 0)',
'-moz-transform' : 'translate(' + heroPos + 'px, 0)',
'-o-transform' : 'translate(' + heroPos + 'px, 0)',
'-ms-transform' : 'translate(' + heroPos + 'px, 0)',
'transform' : 'translate(' + heroPos + 'px, 0)',
'-webkit-transition': '-webkit-transform 1s ' + easeTypeCB,
'-moz-transition': '-moz-transform 1s ' + easeTypeCB,
'-o-transition': '-o-transform 1s ' + easeTypeCB,
'-ms-transition': '-ms-transform 1s ' + easeTypeCB,
'transition': 'transform 1s ' + easeTypeCB
});
clearTimeout(finishAnim);
finishAnim = setTimeout(function(){anim = false; isLoading = false;}, 1000);
$('.hero:eq('+currenth +')').addClass('active');
}
clearTimeout(autoHero);
if(autoCarousel === true){
autoHero = setTimeout(function(){
loadHero('next');
}, 6000);
}
}
}
var showSwitch = ($('.slider-wrapper').length) ? true : false;
//var scrollOffset = -30;
(function($,undefined){$.fn.imagesLoaded=function(callback){var $this=this,$images=$this.find("img").add($this.filter("img")),len=$images.length,blank="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";function triggerCallback(){callback.call($this,$images)}function imgLoaded(){if(--len<=0&&this.src!==blank){setTimeout(triggerCallback);$images.unbind("load error",imgLoaded)}}if(!len)triggerCallback();$images.bind("load error",imgLoaded).each(function(){if(this.complete||this.complete===
undefined){var src=this.src;this.src=blank;this.src=src}});return $this}})(jQuery);
(function(){var special=jQuery.event.special,uid1="D"+ +new Date,uid2="D"+(+new Date+1);special.scrollstart={setup:function(){var timer,handler=function(evt){var _self=this,_args=arguments;if(timer)clearTimeout(timer);else{evt.type="scrollstart";jQuery.event.handle.apply(_self,_args)}timer=setTimeout(function(){timer=null},special.scrollstop.latency)};jQuery(this).bind("scroll",handler).data(uid1,handler)},teardown:function(){jQuery(this).unbind("scroll",jQuery(this).data(uid1))}};special.scrollstop=
{latency:300,setup:function(){var timer,handler=function(evt){var _self=this,_args=arguments;if(timer)clearTimeout(timer);timer=setTimeout(function(){timer=null;evt.type="scrollstop";jQuery.event.handle.apply(_self,_args)},special.scrollstop.latency)};jQuery(this).bind("scroll",handler).data(uid2,handler)},teardown:function(){jQuery(this).unbind("scroll",jQuery(this).data(uid2))}}})();
jQuery(document).ready(function($) {
// $() will work as an alias for jQuery() inside of this function
});
isIE = jQuery.browser.msie
tinymce.ScriptLoader.load(url + '/interface/common.js');
$.getScript(url+'/interface/common.js');