Closed (works as designed)
Project:
Views Isotope (Deprecated)
Version:
7.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2012 at 10:48 UTC
Updated:
7 Sep 2015 at 08:55 UTC
Jump to comment: Most recent
Comments
Comment #1
MrNeko commentedAlright I manage to implement the centered function. The weird thing is .. it doesn't automatically center the div on initial load. It loaded automatically centers the div when I resize the viewport.
Comment #2
kreynen commentedI'm still not exactly sure what you are trying to do and whether something needs to change in the module to allow it... or make it easier.
Can you post either what you did or what you changed to get this to work?
Comment #3
MrNeko commentedhttp://jsfiddle.net/salt/QNkVF/
Ok it might be easier if you have a look at this .. In order to make sure the items are always centered, I need to get the #container div's width to be automatically calculated and apply margin 0 auto; to it. However, there is one problem, the div doesn't calculate the initial width on load. This can be observed when you resize your browser and reload the page, there is a gap on the right side of the div. I used firebug to check and the initial width is not there, and only appear when I start resizing the browser.
I implemented that same code into views_isotope.js and it gives me the same result. The div width is only calculated when I resize the browser.
Comment #4
MrNeko commentedNvm, found the solution, there is a section of code missing from http://isotope.metafizzy.co/custom-layout-modes/centered-masonry.html that needs to be added in.
Comment #5
kreynen commentedComment #6
dureaghin commentedWorks for me!
code from: http://isotope.metafizzy.co/custom-layout-modes/centered-masonry.html
CSS code:
JS code:
Comment #7
kristofferromGreat, works for me too at http://nordicwaves.net
Comment #8
kristofferromGreat, works for me too at http://nordicwaves.net
Comment #8.0
kristofferromChange details
Comment #9
PI_Ron commentedWhere are we meant to put the code from #6, in a custom js file?
Comment #10
truyenle commentedWork for me too.
The code can be placed simply in a custom block or even in view header, etc.
Comment #11
rcodina#6 Works for me too!
@PI_Ron Yes
Comment #12
rcodina#6 Works but if you have multiple Isotope views in the same page, only the first isotope view gets centered. Any idea about centering both Isotope views?
Comment #13
rcodinaI modified the code in #6 so when Isotope view doesn't return results it doesn't produce a JS error. I just added an if to check if property Isotope is available.