Jump to content
php.lv forumi
  • 0

jQuery, bildes apaudzēšana (lightbox)


Question

Posted

Sveiki tautieši. Tātad ir radusies viena problēma ar bildes apaudzēšanu priekš lightbox linka:

 

Biju pirms neliela laika atrisinājis šo problēmu ar jQuery, bet vairs nevaru atrast vajadzīgo funkciju.

 

Tad nu tā:

 

Lapas bilde

 

<img height="100" width="250" alt="" src="biles links"/>

 

Vajadzētu lai JS automātiski visām bildēm, kuras ir noteiktā divā apaudzētu linkus apkārt šādi

 

<a href="bildes links" rel="lightbox"><img height="100" width="250" alt="" src="bildes links"/></a>

3 answers to this question

Recommended Posts

  • 0
Posted

attr metodei var padot arī objektu ar atslēgām/vērtībām, nevajag n-tās reizes attr izsaukt:

$('img').each(function(){
   $(this).wrap($('<a>').attr({
       href: $(this).attr('src'),
       rel: 'lightbox'
   })
});

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...