Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(function() {
- $(".addcart").click(function() {
- var intId = $(".view").size() + 1;
- var fieldId= "field" +intId;
- var img = $(this).parent().children('img').attr('src');
- $('.slideshow-slides .slide').append('<div class="view" id="'+fieldId+'"><img src="'+img+'" /><div class="mask"><h2>' +"Title"+'</h2><button class="deleteimg">'+"DELETE"+'</button></div></div>');
- $(".view").each(function (intId) {
- $(this).css({ left: 240 * intId + 'px' });
- });
- $(".deleteimg").click(function() {
- $(this).parent().parent().remove();
- var wrappers = $(".view");
- if (wrappers.length >= 1) {
- var newId = 1;
- wrappers.each(function(){
- renewId = "field" + newId;
- $(this).attr("id",renewId);
- var newPosition = newId-1;
- $(this).css({ left: 240 * newPosition + 'px' });
- newId++;
- });
- }
- });
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment