Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding array element into the preview box #23

Open
drianautz opened this issue Mar 29, 2015 · 0 comments
Open

Adding array element into the preview box #23

drianautz opened this issue Mar 29, 2015 · 0 comments

Comments

@drianautz
Copy link

Hello, actually how to add array content inside the preview box, i mean if i have the attribute like this, i try it >
HTML at a data

data-size1="Small"
data-size2="Medium"

data-price1="$ 23"
data-price2="$ 49"

On // update preview´s content
var $itemEl = this.$item.children( 'a' ),
eldata = {

size1 : $itemEl.data( 'size1' ),
price1 : $itemEl.data( 'price1' ),
size2 : $itemEl.data( 'size2' ),
price2 : $itemEl.data( 'price2' )

On html push

this.$size1.html( eldata.size1 );
this.$price1.html( eldata.price1 );
this.$size2.html( eldata.size2 );
this.$price2.html( eldata.price2 );

On Preview.prototype =
create : function()

this.$size1 = $( '

' );
this.$price1 = $( '
' );
this.$info1 = $( '
' ).append( this.$size1, this.$price1 );
this.$addtocart1 = $( '' );
this.$item1 = $( '
' ).append( this.$info1, this.$addtocart1 );
this.$variant1 = $( '
' ).append( this.$item1 );

this.$size2 = $( '

' );
this.$price2 = $( '
' );
this.$info2 = $( '
' ).append( this.$size2, this.$price2 );
this.$addtocart2 = $( '' );
this.$item2 = $( '
' ).append( this.$info2, this.$addtocart2 );
this.$variant2 = $( '
' ).append( this.$item2 );

this.$clearfix = $( '

' ).append( this.$variant1, this.$variant2 );

but it's only limit for 2 items, actually how to add an array into this,

Thanks

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant