The information in this thread might be outdated
|

08-20-2013, 09:28 AM
|
 |
Paid Member
|
|
Join Date: Feb 2012
Posts: 20
|
|
No that doesn't seem to want to work... Not too sure what else to do. Its so close!
Heres the edited code below and heres the link to the page: http://www.kooksunlimited.com/shop/#...13&id=26517135
Code:
<div>
<script type="text/javascript" src="http://app.ecwid.com/script.js?1039325" charset="utf-8"></script>
<script>
Ecwid.OnPageLoaded.add(function (page) {
if (page.type == "PRODUCT" && page.productId == 26517135) {
$.ajax({
url: 'http://app.ecwid.com/api/v1/1039325/product?id=26517135',
dataType: 'jsonp',
success: function (json) {
if (json.variations) {
$.each(json.variations, function (index, product) {
// name, thumbnail image url
var productName = product.options.Style.text;
var productsmallThumbnailUrl = product.smallThumbnailUrl;
// elements
var productElement = $('#ecwid-productoption-26517135-Style-' + productName.replace(/\ /g, '_'));
var productInput = productElement.find('input[type=radio]');
var productLabel = productElement.find('label');
// hide radio button
productInput.hide();
// update label css to show images
productLabel.css({
background: 'url("' + productsmallThumbnailUrl + '") repeat scroll 0 0 transparent',
display: 'inline-block',
margin: '5px',
height: '30px',
padding: '1px',
'text-indent': '-9999px',
width: '30px', float: 'left',
});
// Could use .addClass instead of hard coding the style, ie: productLabel.addClass('className');
// Same for .css below that adds border
// handle highlighting of currently selected option
productLabel.click(function () {
$(this).css("border", "solid 1px black");
$("input[type='radio']:checked").each(
function () {
$("label[for='" + this.id + "']").css("border", "none");
}
);
});
});
}
}
});
}
});
</script>
<script type="text/javascript"> xSearchPanel("style="); </script>
</div>
<script type="text/javascript">
ecwidMessages = {
"SearchPanel.search":"GO"
};
</script>
<div class="shopContainer">
<script type="text/javascript" src="http://app.ecwid.com/script.js?1039325" charset="utf-8"></script>
<script type="text/javascript">
xProductBrowser("categoriesPerRow=4","views=grid(5,5) list(10)","categoryView=grid","searchView=list","style="); </script>
<noscript>Your browser does not support JavaScript. Please proceed to <a href="http://kooksunlimited.ecwid.com">HTML version of Kooks Unlimited</a></noscript>
<script type="text/javascript">
Ecwid.OnPageLoaded.add(function(page){
if (page.type == "PRODUCT") {
$( "#tabs" ).tabs();
}
})
</script>
</div>
|

08-20-2013, 09:39 AM
|
 |
Paid Member
|
|
Join Date: Dec 2011
Location: CA / FL
Posts: 345
|
|
Try 2px
Edit: nevermind that won't work. I think you need to go back to just using display: inline-block. I'm not sure how to fix the problem while using float
Last edited by smoothsailingclothing; 08-20-2013 at 09:44 AM.
|

08-20-2013, 09:56 AM
|
 |
Paid Member
|
|
Join Date: Dec 2011
Location: CA / FL
Posts: 345
|
|
It looks like this works:
Code:
<div>
<script type="text/javascript" src="http://app.ecwid.com/script.js?1039325" charset="utf-8"></script>
<script>
Ecwid.OnPageLoaded.add(function (page) {
if (page.type == "PRODUCT" && page.productId == 26517135) {
$.ajax({
url: 'http://app.ecwid.com/api/v1/1039325/product?id=26517135',
dataType: 'jsonp',
success: function (json) {
if (json.variations) {
$.each(json.variations, function (index, product) {
// name, thumbnail image url
var productName = product.options.Style.text;
var productsmallThumbnailUrl = product.smallThumbnailUrl;
// elements
var productElement = $('#ecwid-productoption-26517135-Style-' + productName.replace(/\ /g, '_'));
var productInput = productElement.find('input[type=radio]');
var productLabel = productElement.find('label');
// hide radio button
productInput.hide();
productElement.css({display: 'inline-block'});
// update label css to show images
productLabel.css({
background: 'url("' + productsmallThumbnailUrl + '") repeat scroll 0 0 transparent',
display: 'inline-block',
margin: '5px',
height: '30px',
'text-indent': '-9999px',
width: '30px'
});
// Could use .addClass instead of hard coding the style, ie: productLabel.addClass('className');
// Same for .css below that adds border
// handle highlighting of currently selected option
productLabel.click(function () {
$(this).css("border", "solid 1px black");
$("input[type='radio']:checked").each(
function () {
$("label[for='" + this.id + "']").css("border", "none");
}
);
});
});
}
}
});
}
});
</script>
<script type="text/javascript"> xSearchPanel("style="); </script>
</div>
<script type="text/javascript">
ecwidMessages = {
"SearchPanel.search":"GO"
};
</script>
<div class="shopContainer">
<script type="text/javascript" src="http://app.ecwid.com/script.js?1039325" charset="utf-8"></script>
<script type="text/javascript">
xProductBrowser("categoriesPerRow=4","views=grid(5,5) list(10)","categoryView=grid","searchView=list","style="); </script>
<noscript>Your browser does not support JavaScript. Please proceed to <a href="http://kooksunlimited.ecwid.com">HTML version of Kooks Unlimited</a></noscript>
<script type="text/javascript">
Ecwid.OnPageLoaded.add(function(page){
if (page.type == "PRODUCT") {
$( "#tabs" ).tabs();
}
})
</script>
</div>
Added:
Code:
productElement.css({display: 'inline-block'});
and removed
and
|

08-20-2013, 01:34 PM
|
 |
Paid Member
|
|
Join Date: Feb 2012
Posts: 20
|
|
Yeah that works perfectly now. Just need to find a way of applying this to all products that use the radio button selectors now...
|

08-21-2013, 04:03 AM
|
 |
Paid Member
|
|
Join Date: Dec 2011
Location: CA / FL
Posts: 345
|
|
Quote:
Originally Posted by MalloryMan
Yeah that works perfectly now. Just need to find a way of applying this to all products that use the radio button selectors now...
|
I tried looking for products with radio buttons but there are so many and couldn't find any in my quick search.
This might work for other products. I've just replaced the hard coded product ID with the one from the page.
Code:
Ecwid.OnPageLoaded.add(function (page) {
if (page.type == "PRODUCT") {
$.ajax({
url: 'http://app.ecwid.com/api/v1/1039325/product?id=' + page.productId,
dataType: 'jsonp',
success: function (json) {
if (json.variations) {
$.each(json.variations, function (index, product) {
// name, thumbnail image url
var productName = product.options.Style.text;
var productsmallThumbnailUrl = product.smallThumbnailUrl;
// elements
var productElement = $('#ecwid-productoption-' + page.productId + '-Style-' + productName.replace(/\ /g, '_'));
var productInput = productElement.find('input[type=radio]');
var productLabel = productElement.find('label');
// hide radio button
productInput.hide();
productElement.css({display: 'inline-block'});
// update label css to show images
productLabel.css({
background: 'url("' + productsmallThumbnailUrl + '") repeat scroll 0 0 transparent',
display: 'inline-block',
margin: '5px',
height: '30px',
'text-indent': '-9999px',
width: '30px'
});
// Could use .addClass instead of hard coding the style, ie: productLabel.addClass('className');
// Same for .css below that adds border
// handle highlighting of currently selected option
productLabel.click(function () {
$(this).css("border", "solid 1px black");
$("input[type='radio']:checked").each(
function () {
$("label[for='" + this.id + "']").css("border", "none");
}
);
});
});
}
}
});
}
});
|
The Following User Says Thank You to smoothsailingco.com For This Useful Post:
|
|
The information in this thread might be outdated
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 04:51 PM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
|