Nepal Flag
"Would you Like to Post any thing related to This blog you can send E-mail to me guidedinesh@gmail.com or dinesh_tamang33@yahoo.com"तपाईंहरु पनि यो साईटमा भएका बिषयहरु सँग सम्बन्धित आफ्ना लेखहरु पोस्ट गर्न चाहनु भने तल दिईएको ठेगानामा पठाउनु हुन अनुरोध गर्दछु साथै विज्ञापन तथा अन्यको लागि सम्पर्क ठेगानाः guidedinesh@gmail.com or dinesh_tamang33@yahoo.comतपाईंहरुबाट प्राप्त भएका आर्टिकलहरुलाई सकेसम्म चाडै तपाईंहरुकै नाम दिएर प्रकाशित गरिनेछ ।


Auto apply lightbox effect to all images

In my blog ,DJ Remix Town asked me for how to auto applied Lightbox effect to all images uploaded ,do not need to edit HTML and add rel="lightbox" manually. And now I have the answer for this question :

How to do this ?

First ,you need to read this post and follow all my instruction for install jquery lightbox to blog .

The magic is on the second step ,find and replace this code
<script type="text/javascript">
$(function() {
$('a[rel*=lightbox]').lightBox();
});
</script>

with this

<script type="text/javascript">
$(function() {
$('a[href$=jpg], a[href$=JPG], a[href$=jpeg], a[href$=JPEG], a[href$=png], a[href$=gif], a[href$=bmp]:has(img)').lightBox();
});
</script>

The difference between them is this line $('a[href$=jpg], a[href$=JPG], a[href$=jpeg], a[href$=JPEG], a[href$=png], a[href$=gif], a[href$=bmp]:has(img)').lightBox(); 
This line mean Lightbox effect will be applied to all <a ...> tag which has an <img> tag inside ,and the href attribute of a tag is a link to image file (with the extension : gif,bmp,jpeg,png,jpg)

From now ,you can upload and insert images to your post using uploader in post editor window and don't care for the rest . Lightbox effect will be applied to all images .

0 comments for " "

Leave a reply

DineshTamang.com.np भ्रमण गर्नु भएकोमा यहाँहरु लाई मुरी-मुरी धन्यवाद् छ। कृपया फेरिपनी DineshTamang.com.np चियाउदै गर्नुहोला। तपाईंको दिनहरु सधैं शुभ-रहोस्। धन्यवाद् ।

Sorry

Enter your email address:

Most Popular

Search In This Blog

Popular Posts

Tag Cloud

Recent News