Closed sanbrons closed 10 years ago
Hi,
are you calling the grid function multiple times? If so you should reuse the handler variable and not reinitialize it on each call. Your current code will create a new wookmark instance on each call and won't remove the old one. Maybe that's the source of the problem.
Just move the "var handler = ..." outside of the function.
hi,
i did call grid function multiple time, first is when the page is load and button is click for this example. where should i move the var handler.
Try something like this:
var handler = $('div.tiles div.item');
function Grid(width){
...
}
Gm.g Sent from my BlackBerry 10 smartphone. From: Sebastian HelzleSent: Wednesday, May 14, 2014 08:41To: GBKS/Wookmark-jQueryReply To: GBKS/Wookmark-jQuerySubject: Re: [Wookmark-jQuery] Variable cannot be read for items grid (#137)Closed #137.
—Reply to this email directly or view it on GitHub.
Sent from my BlackBerry 10 smartphone. From: Sebastian Helzle8kk gSent: Wednesday, May 14, 2014 08:41To: GBKS/Wookmark-jQueryReply To: GBKS/Wookmark-jQuerySubject: Re: [Wookmark-jQuery] Variable cannot be read for items grid (#137)Closed #137.
—Reply to this email directly or view it on GitHub.
function itemWidth() { $(".action").click(function() { var width = $(this).attr("data-width"); Grid(width); }); }
function Grid(width){ var handler = $('div.tiles div.item'); handler.wookmark({ align: "center", autoResize: true, // This will auto-update the layout when the browser window is resized. container: $('div.zee-container'), // Optional, used for some extra CSS styling offset: 10, // Optional, the distance between grid items outerOffset: 10, // Optional, the distance to the containers border itemWidth: width // Optional, the width of a grid item }); }
I am trying to send value from
data-width
on click on the button. But the function forGrid()
does not seem to send thewidth
variable into the itemWidth. The value does sent, but it does not enteritemWidth