Javascript - Color box using URL or iframe
We have to use this script where the output will take from url,
Javascript:
========
<script>
function getParameterByName(url, name)
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec(url);
if( results == null )
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
$(document).ready(function(){
$('.dialog-open').each(function() {
$(this).colorbox({
height: 600,
width: 800,
iframe: true,
href: "contact?id=" + getParameterByName($(this).attr("href"), "id")
});
});
</script>
HTML
=====
<a href='test.php?id=$id' class="dialog-open"> test </a>
Source: http://www.jacklmoore.com/colorbox/
Javascript:
========
<script>
function getParameterByName(url, name)
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec(url);
if( results == null )
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
$(document).ready(function(){
$('.dialog-open').each(function() {
$(this).colorbox({
height: 600,
width: 800,
iframe: true,
href: "contact?id=" + getParameterByName($(this).attr("href"), "id")
});
});
</script>
HTML
=====
<a href='test.php?id=$id' class="dialog-open"> test </a>
Source: http://www.jacklmoore.com/colorbox/
Comments
Post a Comment