jQuery 同位素 —居中且流畅/响应灵敏

发布于 2024-12-25 05:50:01 字数 782 浏览 1 评论 0原文

我问一个关于 Isotope 的问题,

它是一个很棒的 jQuery 插件。

我已经玩了一段时间了,但我对 javascript 的了解还不够,无法结合两种同位素技术,响应同位素中心同位素

我已经成功地使用了响应式 mod,它运行得很好,只是现在我需要将整个内容放在 div 中。居中布局模式和响应模式都没有记录,所以我在让它工作时遇到了一些麻烦。基本上,居中布局模式的说明是:

要使用此 mod,请复制演示页面源代码中找到的修改后的方法。

不幸的是,在查看源代码中发生了各种各样的 javascript 事情,而我没有足够的 javascript 经验来挑选它并将其与我已经工作的响应式脚本结合起来。

任何帮助将不胜感激。

一个网站,其中包含我需要的工作示例。

我正在试验的网站。

我认为在 Firefox 中效果更好。

I am asking a question about Isotope

It is a great plugin for jQuery.

I have been playing with it for a while now, but I don't know enough about javascript to combine two of the Isotope techniques, responsive Isotope and centered Isotope.

I have sucessfully used the responsive mod and it worked pretty well, except now I need to center the whole thing within a div. The centered layout mode isn't documented as well as the responsive mode, so I am having some trouble getting it to work. Basically the inscructions for the centered layout mode are :

To use this mod, copy the revised methods found in the demos’ page source.

Unfortunately, there are all sorts of javascript things going on in the view source and I don't have enough experience with javascript to pick it out and also combine it with the responsive script I already have working.

Any help would be greatly appreciated.

A site with a working example of what I need.

My site that I am experimenting with.

Works better in Firefox I think.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

给不了的爱 2025-01-01 05:50:01

以下是 David DeSandro 本人提供的示例:

http://jsfiddle.net/desandro/P6JGY/6/

Here is an example provided by David DeSandro himself:

http://jsfiddle.net/desandro/P6JGY/6/

二智少女猫性小仙女 2025-01-01 05:50:01

这个jsfiddle可能会解决您的问题:http://jsfiddle.net/schmidjon/6Z3sn/
这是带有断点的同位素的简单扩展:

(function ($) {
var $container = $('.example'),
    colWidth = function () {
        var w = $container.width(), 
            columnNum = 1,
            columnWidth = 0;
        if (w > 1200) {
            columnNum  = 5;
        } else if (w > 900) {
            columnNum  = 4;
        } else if (w > 600) {
            columnNum  = 3;
        } else if (w > 300) {
            columnNum  = 2;
        }
        columnWidth = Math.floor(w/columnNum);
        $container.find('.item').each(function() {
            var $item = $(this),
                multiplier_w = $item.attr('class').match(/item-w(\d)/),
                multiplier_h = $item.attr('class').match(/item-h(\d)/),
                width = multiplier_w ? columnWidth*multiplier_w[1]-4 : columnWidth-4,
                height = multiplier_h ? columnWidth*multiplier_h[1]*0.5-4 : columnWidth*0.5-4;
            $item.css({
                width: width,
                height: height
            });
        });
        return columnWidth;
    },
    isotope = function () {
        $container.isotope({
            resizable: false,
            itemSelector: '.item',
            masonry: {
                columnWidth: colWidth(),
                gutterWidth: 4
            }
        });
    };
    isotope();
    $(window).smartresize(isotope);
}(jQuery));

来源:在流体布局中使用 jQuery Isotope 进行砌体

This jsfiddle will probably solve your problem: http://jsfiddle.net/schmidjon/6Z3sn/.
It's a simple extension to Isotope with breakpoints:

(function ($) {
var $container = $('.example'),
    colWidth = function () {
        var w = $container.width(), 
            columnNum = 1,
            columnWidth = 0;
        if (w > 1200) {
            columnNum  = 5;
        } else if (w > 900) {
            columnNum  = 4;
        } else if (w > 600) {
            columnNum  = 3;
        } else if (w > 300) {
            columnNum  = 2;
        }
        columnWidth = Math.floor(w/columnNum);
        $container.find('.item').each(function() {
            var $item = $(this),
                multiplier_w = $item.attr('class').match(/item-w(\d)/),
                multiplier_h = $item.attr('class').match(/item-h(\d)/),
                width = multiplier_w ? columnWidth*multiplier_w[1]-4 : columnWidth-4,
                height = multiplier_h ? columnWidth*multiplier_h[1]*0.5-4 : columnWidth*0.5-4;
            $item.css({
                width: width,
                height: height
            });
        });
        return columnWidth;
    },
    isotope = function () {
        $container.isotope({
            resizable: false,
            itemSelector: '.item',
            masonry: {
                columnWidth: colWidth(),
                gutterWidth: 4
            }
        });
    };
    isotope();
    $(window).smartresize(isotope);
}(jQuery));

Source: Using jQuery Isotope for masonry in fluid layouts

无所谓啦 2025-01-01 05:50:01

尝试在子内容的每个类的 css 文件上使用转换。它应该有帮助,而且可能会更慢

。css

 -webkit-transition: all 1s ease-in-out;
    -moz-transition: all 1s ease-in-out;
    -o-transition: all 1s ease-in-out;
    -ms-transition: all 1s ease-in-out;
    transition: all 1s ease-in-out;

希望这个工作正常

try using the transition on your css file for each of your classes on child content. it should be helpful and it can be more slowmo

.css

 -webkit-transition: all 1s ease-in-out;
    -moz-transition: all 1s ease-in-out;
    -o-transition: all 1s ease-in-out;
    -ms-transition: all 1s ease-in-out;
    transition: all 1s ease-in-out;

hope this working

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文