2012-06-26 31 views
1

我對我的網站有問題。我在IE8讓網頁錯誤/ 9:對象不支持此屬性或方法「同位素」

對象不支持此屬性或方法 '同位素' 行:47字符:3代碼:0

這裏是代碼:

/*----------------------------------------------------------------------------------- 
/* 
/* Custom JS 
/* 
-----------------------------------------------------------------------------------*/ 

/* Start Document */ 
jQuery(document).ready(function($) { 

/*----------------------------------------------------*/ 
/* Responsive Menu 
/*----------------------------------------------------*/ 

     // Create the dropdown bases 
     $("<select />").appendTo("#navigation"); 

     // Create default option "Go to..." 
     $("<option />", { 
     "selected": "selected", 
     "value" : "", 
     "text" : "Menu" 
     }).appendTo("#navigation select"); 


     // Populate dropdowns with the first menu items 
     $("#navigation li a").each(function() { 
     var el = $(this); 
     $("<option />", { 
      "value" : el.attr("href"), 
      "text" : el.text() 
     }).appendTo("#navigation select"); 
     }); 


     //make responsive dropdown menu actually work  
     $("#navigation select").change(function() { 
      window.location = $(this).find("option:selected").val(); 
     }); 

/*----------------------------------------------------*/ 
/* Isotope Portfolio Filter 
/*----------------------------------------------------*/ 

    $(function() { 
    var $container = $('#portfolio-wrapper'); 
    // initialize Isotope 
    $container.isotope({ 
     // options... 
     resizable: false, // disable normal resizing 
     // set columnWidth to a percentage of container width 
     masonry: { columnWidth: $container.width()/12 } 
    }); 

    // update columnWidth on window resize 
    $(window).smartresize(function(){ 
     $container.isotope({ 
     // update columnWidth to a percentage of container width 
     masonry: { columnWidth: $container.width()/12 } 
     }); 
    }); 


     $container.isotope({ 
     itemSelector : '.portfolio-item' 
     }); 

     var $optionSets = $('#filters .option-set'), 
      $optionLinks = $optionSets.find('a'); 

     $optionLinks.click(function(){ 
     var $this = $(this); 
     // don't proceed if already selected 
     if ($this.hasClass('selected')) { 
      return false; 
     } 
     var $optionSet = $this.parents('.option-set'); 
     $optionSet.find('.selected').removeClass('selected'); 
     $this.addClass('selected'); 

     // make option object dynamically, i.e. { filter: '.my-filter-class' } 
     var options = {}, 
      key = $optionSet.attr('data-option-key'), 
      value = $this.attr('data-option-value'); 
     // parse 'false' as false boolean 
     value = value === 'false' ? false : value; 
     options[ key ] = value; 
     if (key === 'layoutMode' && typeof changeLayoutMode === 'function') { 
      // changes in layout modes need extra logic 
      changeLayoutMode($this, options) 
     } else { 
      // otherwise, apply new options 
      $container.isotope(options); 
     } 

     return false; 
     }); 
}); 

/*----------------------------------------------------*/ 
/* Back To Top Button 
/*----------------------------------------------------*/ 
    var pxShow = 300;//height on which the button will show 
    var fadeInTime = 400;//how slow/fast you want the button to show 
    var fadeOutTime = 400;//how slow/fast you want the button to hide 
    var scrollSpeed = 400;//how slow/fast you want the button to scroll to top. can be a value, 'slow', 'normal' or 'fast' 

    jQuery(window).scroll(function(){ 
     if(jQuery(window).scrollTop() >= pxShow){ 
     jQuery("#backtotop").fadeIn(fadeInTime); 
     }else{ 
     jQuery("#backtotop").fadeOut(fadeOutTime); 
     } 
    }); 

    jQuery('#backtotop a').click(function(){ 
     jQuery('html, body').animate({scrollTop:0}, scrollSpeed); 
     return false; 
    }); 

/* End Document */ 
})(); 

怎麼了?

+0

您是否試圖使用[this library](http://isotope.metafizzy.co/)?你有沒有包含必要的JS文件? –

+0

是的,這是來自那裏的石匠元素的同一個圖書館。 – user1482509

+0

請將我詢問的問題數量與您提供的答案數量進行比較。 –

回答

0

您需要定義同位素功能。只有這樣你才能打電話給它。我不認爲同位素()是一種內置函數。

在下面的示例中,我在h1元素上添加了一個函數test(),然後調用它。

$('h1') 
[<h1>​Hello​</h1>​] 

var a = $('h1') 

a.test = function() {console.log(this);} 

a.test() 
[<h1>​Hello</h1>​] 
+0

我試過這個,但它不起作用。還是這個相同的錯誤。也許我做錯了什麼。 – user1482509

相關問題