I wanted to make my own Modal-style javascript box so I could implement it into my existing code easier. I got it working, but I want to make it a bit more advanced...
I want to make it recognize thehrefattribute of the<a>tag being clicked and open the link in a modal. I have it set up as arel=trigger.
Here's what I have so far:
JS:
CSS:Code:<script type="text/javascript"> jQuery(document).ready(function($) { $("a[rel*=popcorn]").click(function() { $("div.modal").addClass("show"); return false; }); $("#closeFancy").click(function() { $("div.modal").removeClass("show"); return false; }); }); </script>
xHTMLCode:div.modal { display: block; width: 560px; position: absolute; top: -310px; left: 170px; padding: 90px 20px 20px 20px; border: solid 1px #999; background: -webkit-gradient(linear, left top, left bottom, from(rgb(255,255,255)), to(rgb(230,230,230))); -webkit-box-shadow: 0px 3px 6px rgba(0,0,0,0.25); -webkit-border-bottom-left-radius: 6px; -webkit-border-bottom-right-radius: 6px; -webkit-transition: -webkit-transform 0.25s ease-out; -webkit-transform: translateY(-570px); } div.modal.show { -webkit-transform: translateY(-110px); }
Thanks,Code:<a href="external.html" rel="popcorn">Open Modal</a>
X96



Reply With Quote

Bookmarks