- This topic is empty.
December 4, 2016 at 1:07 am #248624
what a mouth full! First time posting! ok, working on my site for showing my photography. Most of the headaches I’ve figured out except for 2 things!
- getting a hover function, css, jquery, w/e. on images that I added from a folder using a for loop (187 to be exact).
- getting them to load in horizontally instead of vertically.
i’m very new to all this (used to be an actionscripter) heres all the source stuff
AND THANKS! :D
http://codepen.io/gearheartstudio/pen/xRYzNMDecember 4, 2016 at 1:44 am #248625
note: The gridder.js source in at the end of the body, that was an oops (doesn’t work from that location)December 4, 2016 at 2:31 am #248626BeverleyhParticipant
Hmmmm, there’s the bigger picture here to consider (ironic really when ‘bigger picture’ is the root of concern).
The web page took 36.83 s to load, used 192 requests, and weighed in at 379.5 MB.
379.5MB is MASSIVELY UNSUITABLE for a web page. I’m on mobile and only get 1GB of data allowance per day. Thanks to this one page, a third of my quota is now gone.
Imposing this amount of data onto visitors is a big no-no. It can be countered somewhat with proper image compression/optimisation, but even then, I urge you to consider finding another way to present your images. You could still use this script but use less of them. Paginate them. Break them up in to categories. Only show your very best pieces to drastically cut out HTTP requests/weight. And serve smaller versions to mobile users.December 5, 2016 at 9:49 am #248674bearheadParticipant
So you should definitely resolve the issues Beverley brought up. It would go a long way if you just loaded in optimized thumbnails instead of the full-sized images. If you’re determined to load in 168 images all at one time, they’re going to have to be no larger than like 5-10kb.
With regards to your actual questions:
The hover opacity change on
#photo imgisn’t working because of the opacity animation already on that selector. You’ll need to add
If you’re using css columns for the layout, you aren’t going to be able to get the items to populate horizontally – that just isn’t how css columns work. If you want a horizontal-based layout you should use flexbox, or display:inline-block, or float:leftDecember 5, 2016 at 9:52 am #248675Paulie_DMember
Its probably worth noting that there is no horizontal layout method that will work for “masonry” style layout.
There’s a reason this is usually done by JS.December 5, 2016 at 10:15 am #248676
I knew it had to be js, I just didn’t know how to implement it because nothing was working with my code. I since tweeted the js and was able to get masonry.js to work and now it does exactly what I needed it too, except now there’s gaps at differently orientated photos, working on that now plus a lazy load of sorts that can work with my code.
Thanks for the reply 😊December 5, 2016 at 10:17 am #248677
I got masonry to finally work and it does exactly what I needed, also I was able to assign a class to all the images so now I’ll be able to implement a lazy load, plus I’m shrinking all the files down to 500px width (since right now they rang from 2000px to 4000px) yikes!
Thank you for your response and help and I’ll remember the few things you said for when I need that 😊
- The forum ‘CSS’ is closed to new topics and replies.