jQuery Isotope - 不在响应式/流体网格中工作
我正在构建一个照片博客,该博客利用了 David DeSandro 出色的同位素插件,但目前我在让该插件在响应式/流体网格中按预期工作时遇到一些困难。
www.lewismalpas.co.uk/tumblr(演示)
每个图像都包含在一个 div (.item) 中,该 div (.item) 的显式宽度为 25%,因为图像是灵活的,理论上应该允许内嵌显示四个图像,但是目前只显示两个,我似乎无法弄清楚问题所在。
<script type="text/javascript">
$(document).ready(function(){
//scroll to top of page
$("a.top").click(function () {
$("body,html").animate({scrollTop: 0}, 800);
return false;
});
//Isotope settings
var $container = $('.images')
$container.imagesLoaded( function(){
$container.isotope({
resizable: false, // disable normal resizing
masonry: { columnWidth: $container.width() / 4 }
});
// update columnWidth on window resize
$(window).smartresize(function(){
$container.isotope({
masonry: { columnWidth: $container.width() / 4 }
});
});
});
//layout & search options
$(".header #layout").hide();
$(".header a.layout").click(function() {
$(".header #layout").fadeIn();
$(".header a.fullscreen").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"99%"}, function() {
$(".images").isotope('reLayout');
});
});
$(".header a.grid").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'masonry'});
});
$(".header a.linear").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'straightDown'});
});
});
$(".header #search").hide();
$(".header a.search").click(function() {
$(".header #search").fadeIn();
});
}); //end doc ready
</script>
I am in the process of building a photoblog which utilises the brilliant Isotope plugin by David DeSandro but I am curently having some difficulty getting the plugin to work as intended within a responsive / fluid grid.
www.lewismalpas.co.uk/tumblr (Demo)
Each image is wrapped within a div (.item) which has an explicit width of 25%, as the images are flexible this in theory should allow four images to be displayed inline, however at the moment only two are being displayed and I cannot seem to figure out the issue.
<script type="text/javascript">
$(document).ready(function(){
//scroll to top of page
$("a.top").click(function () {
$("body,html").animate({scrollTop: 0}, 800);
return false;
});
//Isotope settings
var $container = $('.images')
$container.imagesLoaded( function(){
$container.isotope({
resizable: false, // disable normal resizing
masonry: { columnWidth: $container.width() / 4 }
});
// update columnWidth on window resize
$(window).smartresize(function(){
$container.isotope({
masonry: { columnWidth: $container.width() / 4 }
});
});
});
//layout & search options
$(".header #layout").hide();
$(".header a.layout").click(function() {
$(".header #layout").fadeIn();
$(".header a.fullscreen").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"99%"}, function() {
$(".images").isotope('reLayout');
});
});
$(".header a.grid").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'masonry'});
});
$(".header a.linear").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'straightDown'});
});
});
$(".header #search").hide();
$(".header a.search").click(function() {
$(".header #search").fadeIn();
});
}); //end doc ready
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论