-
Notifications
You must be signed in to change notification settings - Fork 479
v1.3.0 #80
v1.3.0 #80
Changes from 8 commits
14bc64a
7d91a20
018558f
dfaba42
95089b6
f63eef7
b2cba6a
776ece1
e4168aa
e975b4b
0c41e2f
9c56c35
b76d180
25eaf9e
bf7944e
bdf0763
346b2fe
0b8ec8d
55b851e
249e834
dbf846d
446ebee
eaad033
2b5067a
17fe5c2
83a3409
492a463
47f3cce
9619eff
1763465
2e068be
9f41e8b
9270fd5
2ab9097
ba00104
5562ce9
ff976a3
c44238c
0241ab8
725370b
0fa0adb
15b2270
01f1475
71a3f4e
04ee025
1097df7
3acd390
43f7580
c1f9bf7
0f06d17
204cb4a
82bc344
9936572
17879fd
4a88388
42e9d8b
9850400
73fb485
0f3285e
920e441
3a46f64
bea95cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,39 @@ | ||
$(function() { | ||
window.shop = window.shop || {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thoughts on this structure for Timber's JS file? Before it was simply a docready call, but I'd prefer to push toward some kind of structure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like it, only thing is might want to create a more specific var name, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 - a few thoughts, though they're by no means deal breakers:
All in all though, I feel this is much more extensible and readable :) |
||
|
||
var shop = { | ||
|
||
el: { | ||
html: $('html'), | ||
body: $('body') | ||
}, | ||
|
||
init: function () { | ||
shop.el.html.removeClass('no-js').addClass('js'); | ||
|
||
$('html').removeClass('no-js').addClass('js'); | ||
this.productImageSwitch(); | ||
}, | ||
|
||
productImageSwitch: function () { | ||
var mainImage = $('#productPhoto img'), | ||
thumbImages = $('#productThumbs a'), | ||
newImage; | ||
|
||
if (!thumbImages.length) { | ||
return; | ||
} | ||
|
||
// Switch the main image with one of the thumbnails | ||
// Note: this does not change the variant selected, just the image | ||
thumbImages.on('click', function(e) { | ||
e.preventDefault(); | ||
newImage = $(this).attr('href'); | ||
console.log(newImage); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove console.log |
||
mainImage.attr({ src: newImage }); | ||
}); | ||
} | ||
} | ||
|
||
// Initialize Timber's JS on docready | ||
$(function() { | ||
window.shop.init(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't work with IE8, assuming that's ok for Timber?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, just sets the border as transparent to get ready for a CSS transition so it can be ignored for IE8.