Tech Insight !

Technical blog on ASP.Net, PHP, Web Development, Web hosting , Database Programming
Home » HTML » Implementing JQuery Model Popup Plug-In and Playing FLV file in a model popup

Implementing JQuery Model Popup Plug-In and Playing FLV file in a model popup

Implementing J-Query Model popup Plug In

As shown in above screen, developing Model Popup will require 2 layers:

  1. Disabled Back ground
  2. Popup content Panel

We will implement a plug In and call it on Popup Panel element.

Somewhat like: $(“div.popupDiv”).ShowPopup();

ShowPopup();
Is a plug-In method which will initiate an instance of the plug-In which we going to implement as next step.

Prior to that a CSS for Disabled background needs to be developed

Which we can achieve as below:

.popupbackGround

{

position: absolute;

height: 100%;

width: 100%;

left: 0px;

top: 0px;

background-color: #000;

z-index: 1;

opacity: 0.5;

filter: alpha(opacity =50);

display: none;

}

We don’t have to assign this CSS class anywhere in HTML, but we will use this class while implementing Plug-In.

Next to this, we will implement Model Popup J-Query Plug-In.

Parameter to be passed to Plug-In: closeButtonCSS

The plug in will be called on the popup panel itself and take one parameter called CloseButtonCSS which will be used to close the Model popup.

We will create close event on the specified close button in parameter.

model-popup.js (Plug-In file)

jQuery.noConflict();

(

function($K){

$K.fn.ShowPopup=function(data)

{

/*

Parameters:

closeButtonCSS,

*/

$K(this).each(function(i)

{

var dbBack,intTopAxis=0;

var objCloseButton= $K(“.” + data.closeButtonCSS);

var objPopup= $K(this);

var a;

objCloseButton.click(function(){

HidePopup();

});

$K(window).scroll(function()

{

var xTop= parseInt($K(window).scrollTop()) + intTopAxis ;

objPopup.animate({top:xTop+ “px”},{queue: false, duration: 350});

});

initBackGround = function()

{

dbBack  = $K(“<div></div>”).attr(“class”,“popupbackGround”).css(“height”,$K(document).height()).hide();

$K(“body”).append(dbBack);

intTopAxis= parseInt(($K(window).height())/2)-(objPopup.height()/2);

}

ShowPopup = function()

{

initBackGround();

dbBack.fadeIn(function(){objPopup.show();});

objPopup.css({“left”: (($K(window).width())/2)-(objPopup.width()/2),“top”: (($K(window).height())/2)-(objPopup.height()/2)+parseInt($K(window).scrollTop())}) ;

}

HidePopup = function()

{

objPopup.fadeOut();

dbBack.fadeOut();

}

ShowPopup();

});

}

})(jQuery);


How to call Model Popup

Popup Plug-In can be called on any Div object. And the DIV itself will get displayed as a popup like shown in the above screen.

For example:

Target popup DIV class is popupDiv.


<div class=”popupDiv”>

<div>

Popup Content Goes Here..

</div>

<div class=”close”><class=”lnkClose”><img src=”resource/small-closelabel.gif” /></a>

</div>

</div>

We can popup by placing the following javascript :

$k(“div.popupDiv”).ShowPopup(

{

closeButtonCSS:“lnkClose”

});

Here “closeButtonCSS:“lnkClose” is used to treat lnkClose as close button of popup.

Playing FLV

To play any FLV file in HTML will require a flash based FLV player. There are many FLV players available among of those we will use one, which is a flash file and we can play FVL using the flash FLV player.

Here we will require 2 flash (SWF) files:

  1. flvplayer.swf (download )
  2. SteelExternalAll.swf (needs to be placed on same path of container HTML page) (Download)

Below is how to embed object in HTML page to play FLV using above FLV player.

<object id=”Object1″ height=”380″ width=”400″ classid=”clsid:D27CDB6E-AE6D-11cf-96B8- 444553540000″ codebase=”http://macromedia.com/cabs/swflash.cab#version=6,0,0,0″>

<param name=”movie” value=”flash/flvplayer.swf” />

<param name=”FlashVars” value=”flvurl=../flash/test.flv” />

<param name=”quality” value=”high” />

<param value=”true” name=”autoplay” />

<embed height=”380″ width=”400″ src=”flash/flvplayer.swf” flashvars=”flvurl=../flash/test.flv” type=”application/x-shockwave-flash” />

</object>

Above code will take FLV file path as a parameter, that is been specified at 2 places.

  1. flashvars=”flvurl=../flash/test.flv”
  2. <param name=”movie” value=”flash/flvplayer.swf” />

Your FLV file path will go here.

Putting all together

Now we got both things ready with us.

  1. Implemented J-Query plug-In for model popup
  2. FLV player

Simply placing the <object> tag inside the Popup Div will result in our targeted output.

In addition to that we will require a Button to be clicked to show model popup. Like shown below

<a class=”lnkPopup”>Play FLV in Popup</a>

Let’s create a simple J-Query click event of the above link and call popup plug-In inside click event, like shown below.


<script type=”text/javascript” language=”javascript”>


var $k=jQuery.noConflict();

$k(document).ready(function()

{

$k(“a.lnkPopup”).click(function()

{

$k(“div.popupDiv”).ShowPopup(

{

closeButtonCSS:“lnkClose”

});

});

});

</script>

You can also download full source code ZIP file by clicking here .

NOTE :

If you are in need of any Web Development feel free to Inquire us . Dhanashree Inc. Expertise in Asp.net Development, Php Development, Website designing, Open Source customisation. Dhanashree Inc can be our offshore development company / outsourcing web development company, hire dedicated web programmers.

Above information is for knowledge sharing if you have problem / issue / suggestion please intimate us with details for proper and prompt action.

30 Responses to “Implementing JQuery Model Popup Plug-In and Playing FLV file in a model popup”

  1. [New Post] Implementing JQuery Model Popup Plug-In and Playing FLV file in a model popup – via @twitoaster http://techinsight.dhanashree.com/implem...
    via Twitoaster

  2. [...] Tech Insight ! » Implementing J-Query Model Popup Plug-In and … [...]

  3. Nice post and this mail helped me alot in my college assignement. Thanks you as your information.

  4. great post as usual!

  5. Oh mankind that you so much quest of your enter at high-mindedness time. It helped me in my assignment. Thanks Alot

  6. My cousin recommended this blog and she was totally right keep up the fantastic work!

  7. Nice fill someone in on and this post helped me alot in my college assignement. Gratefulness you on your information.

  8. I have been looking everywhere for this info. The search is finally over, great post!

  9. Thank you so much for sharing a lot of this great info! I am looking forward to checking out more.

  10. Amazing summary, saved the website for hopes to see more information!

  11. Thanks so much for writing this awesome content! I am looking forward to checking out more.

  12. Great summary, saved your website with hopes to read more!

  13. The informal summary encouraged me very much! Bookmarked the blog, extremely excellent categories just about everywhere that I read here! I like the information, thanks.

  14. This excellent article encouraged me very much! Bookmarked the website, very great topics just about everywhere that I see here! I appreciate the information, thank you.

  15. Thank you very much for posting all of the awesome info! I am looking forward to seeintg more!

  16. Informative story, saved the blog with hopes to see more!

  17. Helpful write up, saved your site in interest to read more!

  18. Great summary, bookmarked your website for interest to see more information!

  19. Great post, saved your site for interest to read more!

  20. The nice article encouraged me very much! Saved the website, extremely excellent categories just about everywhere that I see here! I like the information, thank you.

  21. This formal article assited me very much! Bookmarked the website, extremely great topics just about everywhere that I read here! I like the information, thank you.

  22. Thanks for taking the time to discuss this, I really feel strongly about it and also love learning more on this topic. If possible, as you gain competence, would you mind updating your blog with more information? It is really helpful for me.

  23. amaze I fully like your own world wide web publication constantly keep choice up the opinion I will perhaps pop in a number of other many best time for you to behold some more believe anybody.impressive I definitely akin to your own blogging site maintain finest included in the information I definitely may pop in a number of more best time to read by means of a number of a lot more belief an ton.

  24. Thank you for the work you have put into your nice blog. We will bookmark to your blog because it is very informational. We love the site and will come back to see your new posts.

  25. What’s up everyone? My name is John I’m from Colorado. I’m new to the forum and just wanted to say hi.. I hope I posted this in the right section

    poker online gratis

    financial help
    magia negra
    wireless reading device
    scholarships

    best wireless reading reviews device

  26. really I genuinely akin to your current position retain which are facts I will likely pop in a lot of multiple other juncture to start rendition a few a lot more credit per ton.melbeeHoCeC

  27. Informative write up, saved the blog in interest to see more!

  28. hola!, I am new here at techinsight.dhanashree.com
    My name is Tobias.

    .

    horoscopo diario

  29. Generally departed and desire for eel

  30. Great summary, saved the website for hopes to see more information!

Leave a Reply