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

Data-generated widgets fail to recognize passed in IDs #5

Open
sjwilliams opened this issue May 6, 2014 · 1 comment
Open

Data-generated widgets fail to recognize passed in IDs #5

sjwilliams opened this issue May 6, 2014 · 1 comment
Labels

Comments

@sjwilliams
Copy link
Owner

_prepItem generates a domID, even if you pass in an id via the content array

$('#container').ScrollStory({
    content: [{hed:'Headline1', id:'myid1'}, {hed, 'Headline2', id: 'myid2'}]
});

_prepItem should probably be something like this:

// use exisiting ID or generate a new one
if ($el.attr('id')) {
    id = $el.attr('id');
} else {
    if (data.id){
        id = data.id;
    } else {
        id = 'scrollStory_story_' + index;
    }

    $el.attr('id', id);
}
@sjwilliams sjwilliams added the bug label May 6, 2014
@sjwilliams
Copy link
Owner Author

I should probably also check that ID is a string and a valid DOM ID string, as its possible that an external data source could have an id column that ends up being passed in, unaware of DOM ID restrictions.

I'd also need to make sure the ID was unique, which is, I believe, the reason I didn't add this feature originally.

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

No branches or pull requests

1 participant