【发布时间】:2015-07-22 18:40:21
【问题描述】:
因此,如果您查看:http://uniplaces.micrositesonline.info/blog/cities/,您将看到同位素砌体插件正在运行。整个主题来自https://themetrust.com/demos/swell/。问题是,在我们的网站上,同位素插件以一种奇怪的方式加载,包含砖石图像的 div 无法正确调整高度,因此有时会被切断。您通常可以通过在页面加载后重新加载页面来复制它。
包含js的代码在'themetrust.js'中:
///////////////////////////////
// Project Filtering
///////////////////////////////
function projectFilterInit() {
if( jQuery('#filter-nav a').length > 0 ) {
jQuery('#filter-nav a').click(function(){
var selector = jQuery(this).attr('data-filter');
jQuery('#projects.thumbs').isotope({
filter: selector,
hiddenStyle : {
opacity: 0,
scale : 1
}
});
if ( !jQuery(this).hasClass('selected') ) {
jQuery(this).parents('#filter-nav').find('.selected').removeClass('selected');
jQuery(this).addClass('selected');
}
return false;
});
} // if() - Don't have this element on every page on which we call Isotope
}
///////////////////////////////
// Project thumbs
///////////////////////////////
function isotopeInit() {
setColumns();
gridContainer.isotope({
resizable: true,
layoutMode: 'masonry',
masonry: {
columnWidth: colW
}
});
jQuery(".thumbs .small").css("visibility", "visible");
}
///////////////////////////////
// Isotope Grid Resize
///////////////////////////////
function setColumns()
{
var columns;
var gw = gridContainer.width();
var ww = jQuery(window).width()
if(ww<=700){
columns = 1;
}else if(ww<=870){
columns = 2;
}else{
columns = 3;
}
colW = Math.floor(gw / columns);
jQuery('.thumbs .small').each(function(id){
jQuery(this).css('width',colW+'px');
});
jQuery('.thumbs .small').show();
}
function gridResize() {
setColumns();
gridContainer.isotope({
resizable: false,
layoutMode: 'masonry',
masonry: {
columnWidth: colW
}
});
}
///////////////////////////////
// Center Home Banner Text
///////////////////////////////
function centerHomeBannerContent() {
var bannerContent = jQuery('.home #banner-content');
var bannerContentTop = (windowHeightAdjusted/2) - (jQuery('.home #banner-content').actual('height')/2);
bannerContent.css('margin-top', bannerContentTop+'px');
bannerContent.show();
}
///////////////////////////////
// Initialize
///////////////////////////////
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery(".content-area").fitVids();
mmenu_nav();
jQuery('#video-background').height(windowHeight);
video_resize();
if(!isMobile()){
getVideoBGs();
}
jQuery('body').imagesLoaded(function(){
projectFilterInit();
isotopeInit();
centerHomeBannerContent();
});
jQuery(window).smartresize(function(){
gridResize();
//full_width_images();
video_resize();
mmenu_nav();
centerHomeBannerContent()
});
//Set Down Arrow Button
jQuery('#down-button').click(function(){
jQuery.scrollTo( ".middle", {easing: 'easeInOutExpo', duration: 1000} );
});
//pull_out_the_quote();
//full_width_images();
});
我们尝试对其进行修改,删除和调整,但似乎没有任何效果。在这一点上,我们认为它是由类 isotope-item 初始化的 css 转换,因此我们将其删除,这似乎有效,但我们不完全确定原因。是否有可能保留过渡并让同位素插件可靠地与它们一起运行?
【问题讨论】:
-
您的投资组合过滤器在哪里?为什么不联系主题作者?
-
好的,我再次加载了该站点,现在它可以工作了。正如 DCdaz 所说,脚本不会一直加载。尝试最小化 js 文件夹中的所有脚本(小心将这个新脚本文件排入 functions.php 中,并将旧的出列)。或者使用可以优化您的网站的插件(自动优化,W3 Total Cache)...
标签: javascript jquery html css jquery-isotope